PROGRAMMING

  MINTE9
REMEMBERS




Last update:   12-01-2022

Types

There are eight basic data types in JavaScript.
 
/**
 * The typeof operator returns the type of the argument.
 * In javascript there is no char type, only string.
 */

console.log(typeof undefined);      // undefined
console.log(typeof 0);              // number
console.log(typeof 10n);            // bigint
console.log(typeof true);           // boolean
console.log(typeof "foo");          // string
console.log(typeof Symbol("id"))    // symbol
console.log(typeof Math);           // object
console.log(typeof alert);          // function

Null

! Null is not an object, it a special type which represents nothing.
 
/**
 * Null is a special data type which represents nothing.
 */

let a;
let b = null;

console.log(typeof a); // undefined
console.log(typeof b); // object

Backsticks

! Allows us to embed variables and extensions into a string.
 
/**
 * With backsticks we can embed variables into strings. 
 */

let s = "World";

console.log(`Hello, ${s}!`); 
    // Hello World!

console.log(`
    The sum is:
    ${1 + 2}
` );
    // The sum is:
    // 3

Questions     github Fundamentals
Type conversions
        A B C D E F
🔔
1/3