Why don't we need quotations for numbers or booleans?

I have a question about using let as a variable. In one example, the value assigned to the variable after the = sign is put in quotes, and in other examples (the Boolean false and the number), no quotes were used. Is there an easy way to remember when quotes should be used and when they shouldn’t?

4 Likes

The quotes is used only with string argument, boolean and number don’t need it.
If you put quotes around a number, or boolean, it will be treated as a String

11 Likes

When declaring a variable using let and that variable being a number or a boolen, is quoatations not required?

Given quotation marks are for strings, so no

We only use quotes (’’, “”) for strings. Not for numbers and boolean.

We don’t use let as a variable. We assign variables using let

2 Likes

Although both are primitive data types but symbols, numbers, boolean, null and undefined are all used without quotes (’ ').

Whereas, only string is used with quotes. For reference this information is available from from the very initial chapters of JS.