@jgCarroll/

typeOfDataTypes

JavaScript

A common interview question

fork
loading
main.js
1
2
3
4
5
6
7
console.log(typeof null); // logs object. Null is of the type object
console.log(typeof undefined); // logs undefined
console.log(typeof {}); // logs object
console.log(typeof []); // logs object. Arrays are of the type object

console.log(Array.isArray({})) // logs false
console.log([] instanceof Array) // logs true
Native Browser JavaScript