1. Truthy and Falsy

  • false
  • 0 (zero)
  • ‘’ , “” (empty string)
  • undefined
  • null
  • NaN
let x = null;let y = 4;let z = 8
if(y) {console.log(y + z)} // y contains the inherent boolean value true
if(!x) {console.log(y - z)} // x contains the inherent boolean value "false" !x makes it opposite

2. Null and Undefined



The Primitive Types

  • Number
  • String
  • BigInt
  • Symbol
  • Boolean
  • Undefined
  • Null

and, The Structural Types

  • Object
  • Function

Checking the Type

const typeChecking = "This is a string"console.log(typeof typeChecking) // output: string

Number


const array = [1, 2, 4, 7, 8, 0];console.log(array[0]) // output: 1
console.log(array[2]) // output: 4
console.log(array[5]) // output: 0
console.log(array[6]) // output: undefiled

Arique Ahsan

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store