Data types
A number
alert( 1 / 0 ); // Infinity
alert( Infinity ); // Infinity
alert( "not a number" / 2 ); // NaN, such division is erroneous
alert( "not a number" / 2 + 5 ); // NaNA string
let str = "Hello";
let str2 = 'Single quotes are ok too';
let phrase = `can embed ${str}`;let name = "John";
// embed a variable
alert( `Hello, ${name}!` ); // Hello, John!
// embed an expression
alert( `the result is ${1 + 2}` ); // the result is 3A boolean (logical type)
The “null” value
The “undefined” value
Objects and Symbols
The typeof operator
Last updated