Js Objects | Table O Contents

In an Object variable, the developer may mix value types …

Note. The Flammarion Logo Badge in the page header above is an .svg image file set to the dimensions of 5% width, auto height, and zoom. Go ahead and test the zoom-out feature by hovering over the badge to engage the expansion of the image.

Object Variables

Hint. An Object variable can be instantiated with a set of curly braces enclosing a set of key-value pairs.

More to come …


var universa = {state: 'Florida', name: 'Florida Southern', enrollment: '10,000'};

Mixing Value types

For, example …

In the above universa Object variable, the key enrollment represents a number value type.

Whereas, the state key represents a string value type.

Inheritance

Because an Object variable is actually spawned by the built-in Object Class, the now var object universa may call the methods of its parent Class using dot notation, as follows:


universa.isCamelCase();

;where isCamelCase is an exposed function of the built-in Object Class.

Properties

The properties of the var object universa may also be called with dot notation substituting the value of each property for the name of the function in the above example, as follows:


universa.enrollment;

;where the value of the property enrollment is returned, as follows:


10,000

Function Values

When constructing your Object variable, mixing and matching value types is agreeable to the underlying Javascript interpreter.

For example, rather than a normal value of type String, or a numeric value of type Number, why not try a method value of type Function?

Just plug your function code into one of the placeholders of your Object variable, as follows:


run: function() {console.log('go fast!')}};

Last Subtitle

More to come …


Note. The above synopsis was derived from an article written by Blank Author [1].

  1. A Narrative of Psychology by Blank Author, Jan #1999

Support

Please support the co-workers who aggregate the Source Links for our projects.

Patreon

Like what you see in this project? If so, then support the authors and machine-elves who aggregate the source links and pages for our projects via Patreon.