JavaScript for impatient programmers by Dr. Axel Rauschmayer

JavaScript for impatient programmers by Dr. Axel Rauschmayer

Author:Dr. Axel Rauschmayer
Language: eng
Format: epub
Published: 2019-05-14T16:00:00+00:00

So far, we have always used objects as records. Property keys were fixed tokens that had to be valid identifiers and internally became strings:

const obj = { mustBeAnIdentifier: 123, }; // Get property assert.equal(obj.mustBeAnIdentifier, 123); // Set property obj.mustBeAnIdentifier = 'abc'; assert.equal(obj.mustBeAnIdentifier, 'abc');

As a next step, we’ll go beyond this limitation for property keys: In this section, we’ll use arbitrary fixed strings as keys. In the next subsection, we’ll dynamically compute keys.

Two techniques allow us to use arbitrary strings as property keys.


Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.