Coding / Programming Videos

Post your favorite coding videos and share them with others!

[JavaScript] Data Types – Aaron Lu – Medium

Source link

Complex Data

The typeof operator can return one of two complex types:

The typeof operator returns object for both objects, arrays, and null.
The typeof operator does not return object for functions.

typeof {name:'John', age:34} // Returns "object"
typeof [1,2,3,4] // Returns "object" (not "array")
typeof null // Returns "object"
typeof function myFunc(){} // Returns "function"

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

Source link


Leave a Reply

Please Login to comment
Notify of
Translate »