Objects
Dicts are objects, access members with ['name'] or .name
var person = {}; //{}
var person1 = new Object();Iterate Over
Object.keys(p).map(k => )
Object.entries(p).map(([k, v]) => )
Object.values(p).map(v => )
for (let key of Object.keys(players)) {
//.......
}General
Check in
'x' in {'x': 1} //trueCombine Objects
Objects/keys on the right override those to the left
Copy
Delete
Equality
=== will do ptr equality
Use lodash .isEqual for deep equality
Old Classes
To define functions out of scope,
Can always add new values
Prototypes?
objects can have a prototype object that all instances inherit from, everyone inherits from object prototype
Changes to prototype affect all people
Create
Object.create makes a new object with the object given as its prototype, basically defining a subclass
Inheritance
Its a mess, stupid javascript didn't want to do this
Last updated