Object with integer
typed keys are automatically sorted
in ascending order.
// integer keys const integerKeyObject = { 100: "a", 2: "b", 7: "c" }; Object.keys(integerKeyObject); // ["2", "7", "100"]
String
typed keys are not sorted.
// string keys const stringKeyObject = { "c": "somestring", "a": 42, "b": false }; Object.keys(stringKeyObject); // ["c", "a", "b"]
.toString()
Has a particular behavior when called on an object:
[object Undefined]
.[object Null]
.O
be the result of calling ToObject passing the this
value as the argument.class
be the value of the [[Class]]
internal property of O
.String value
that is the result of concatenating the three Strings [object ", class, and "]
.Variables
or dynamic expressions
can be used as a key
using [dynamic_key]
syntax.
const columns = { // dynamic key running the uuid() function [uuid()]: { value: "some value" } }
In above example, [uuid()]
is a dynamic property where the value is returned from running the uuid()
function.
type ObjWithDynamicKey = { [key: string]: "whatever type it can be", "hardCodedName": "whatever type it is", }