Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Literal values in JavaScript (numbers, strings, booleans, etc.)

  • Numbers (42, 2.3, NaN, Infinity, -Infinity)
  • Strings (“”, ‘’)
  • Booleans (true, false)
  • null
  • undefined
  • Objects (incl. Arrays, Functions)
console.log(42);
console.log(2.3);

console.log("hello");
console.log('world');

console.log(undefined);
console.log(null);
console.log(NaN);

console.log(Infinity);
console.log(-Infinity);


console.log(true);
console.log(false);
  • Numbers in JavaScript is 64-bit floating point (double)
  • Regular arithmetic issues 0.1+0.2 is not exactly 0.3