Question

What are the types of values in JavaScript?

#javascript

Answer

The simple types of JavaScript are numbers, strings, booleans (true and false), null, and undefined. All other values are *objects*. Numbers, strings, and booleans are object-like in that they have methods, but they are immutable. Objects in JavaScript are mutable keyed collections. In JavaScript, arrays are objects, functions [2] are objects, regular expressions are objects, and, of course, objects are objects.

[1] Crockford's "JavaScript: The Good Parts", Chapter 3, Objects

[2] Crockford's "JavaScript: The Good Parts", Chapter 4, Functions

Learn

Author

xavi

Reviews
Last
next

Students 0