Console Learner — An interactive JavaScript course.


1.2 Object Types

The primitive object type is the basis for the built-in object types, some of which are:

Objects are implemented as an (ordered) hash set (i.e. a hash table). This means that property lookup is an O(1) (constant time) operation. So any object can serve as a quick lookup table.
Arrays are objects with positive numeric integer property names (instead of strings). The built-in length property is also updated automatically.
These are seldom used to create wrapper objects, as those are normally not needed. However, they are sometimes used for type conversions (which will be explained soon).
>>>
{ a: 'value', b: 123, 'c': null }
{ "a": "value", "b": 123, "c": null }
This object literal syntax is also known as JSON and is commonly used for data transfer.
>>>
[1, 2, 'c']
[1, 2, "c"]
Array literals are also part of JSON.
>>>
( function() {} )
function () {}
Functions are explained in detail in a later chapter. For now it is enough to note that functions are first-class citizens, i.e. can be handled as any other value.
>>>
/.*/g
/.*/g
A regular expression literal is converted to a RegExp object at run-time, not parse-time. This means that some errors won't be detected until the code is executed.
>>>

The console allows you to interact with the course material and examples. Use the following keys:

A special logging function is also available:


Need more magic? Check out the other developer tools on this site.