This site is mobile accessible. Press the "Tap Here" button to use a smaller font-size.

Smartphone icons created by Freepik - Flaticon

JavaScript Operators

The typeof Operator

The typeof operator returns object for both objects, arrays, and null.

The typeof operator does not return object for functions.

document.getElementById("demo").innerHTML = 
typeof {name:'john', age:34} + "<br>" +
typeof [1,2,3,4] + "<br>" +
typeof null + "<br>" +
typeof function myFunc(){};

The typeof operator returns "object" for arrays because in JavaScript arrays are objects.