JavaScript Literals
JavaScript Literals are the fixed values, which are constant in nature throughout the program execution.
- String literals must be enclosed with single or double-quotes.
- Number literals must not be enclosed with quotes.
var name = "Jack Sparrow"; //String literal "Cheese" is enclosed with double quotes.
var address = '123 ABC STREET'; //String literal "address" is enclosed with single quotes.
var id = 1001; //Number literal "1001" is not enclosed with quotes.
var price = 120.25; //Decimal literal "120.25" is not enclosed with quotes.
Overall
JavaScript literals are the values that remain constant throughout the program execution.