Reads a field of this object by its name.
Reads a field of this object by its name.
Writes a field of this object by its name.
Writes a field of this object by its name.
Deletes a property of this object by its name.
Deletes a property of this object by its name. The property must be configurable. This method is equivalent to the "delete" keyword in JavaScript.
Since we are using strict mode, this throws an exception, if the property isn't configurable.
Tests whether this object has the specified property as a direct property.
Tests whether this object has the specified property as a direct property.
Unlike js.Object.hasProperty, this method does not check down the object's prototype chain.
MDN
Tests whether this object is in the prototype chain of another object.
Tests whether this object is in the prototype chain of another object.
Tests whether the specified property in an object can be enumerated by a call to js.Object.properties, with the exception of properties inherited through the prototype chain.
Tests whether the specified property in an object can be enumerated by a call to js.Object.properties, with the exception of properties inherited through the prototype chain. If the object does not have the specified property, this method returns false.
MDN
Dictionary "view" of a JavaScript value.
Using objects as dictionaries (maps from strings to values) through their properties is a common idiom in JavaScript. This trait lets you treat an object as such a dictionary.
To use it, cast your object, say
x
, into a Dictionary usingthen use it as
To enumerate all the keys of a dictionary, use js.Object.keys, which returns a js.Array of the properties. It can be used in a for comprehension like this: