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 and types

  • typeof
  • number
  • string
  • boolean

console.log(42);          // 42
console.log(3.14);        // 3.14
console.log("some text"); // some text
console.log('more text'); // more text
console.log("42");        // 42
console.log(true);        // true
console.log("true");      // true

console.log('')
console.log(typeof 42);     // number
console.log(typeof 3.14);   // number
console.log(typeof "text"); // string
console.log(typeof 'text'); // string
console.log(typeof "42");   // string
console.log(typeof true);   // boolean
console.log(typeof "true"); // string