Understanding String Literals and Boolean Literals
Understanding String Literals and Boolean Literals in JavaScript.
String Literals
A string literal is a sequence of one or more letters, numbers or punctuation marks, enclosed in double quotes (" ") or single quotes (' ').
Example- "This is my hashnode blog"
"June 28, 1998"
" "
"I am a frontend developer"
Boolean Literals
Boolean literal is very simple among all the literal data types because they have only one of two values: True or False.
They seem to be very simple but they are actually very useful because they have the ability to check whether the particular variable or condition is true or false.
You can assign a boolean literals directly to a variable, like this
Example- currentAge == "twenty-five"
This compares the expression currentAge == "twenty-five" It will check the value of a string "twenty-five" If the expression evaluates to be true it means the currentAge is "twenty-five".
If the expression evaluates to be false it means the currentAge is not "twenty-five".
Conclusion-
Understanding String Literals and Boolean Literals in JavaScript.