I confuse in this topic!


when i am writing within quotes like this "junk".......var junk=["sss","ooo",333,123];
its showing on output screen like this.
junk<-------------- output
when i dont use quotes, it is giving the data like this
[ 'sss', 'ooo', 333, 123 ] output screen value


I will explain this to you:

If something is given in quotes that means it is a string. So if you type to console.log something within quotes it will print what is written inside quotes.

The next case, without quotes:

If you have typed "var junk=["sss","ooo",333,123];", it means that you have created an array which holds the values given inside square brackets. This means that the word junk holds the values given inside the brackets. So if you type junk without quotes you are referring to the values inside square brackets.

HOPE YOU UNDERSTOOD :smile::blush:

If you are thinking what'll happen if you don't type in "var junk=["sss","ooo",333,123];", then it'll produce an error that junk is not defined(if you are console.logging 'junk' without quotes)



i got it :smiley: :smile: