What I found by reading source code Flashcards
Static method
A static method (or static function) is a method defined as a member of an object but is accessible directly from an API object’s constructor, rather than from an object instance created via the constructor.
https://developer.mozilla.org/en-US/docs/Glossary/Static_method
Object.getOwnPropertyDescriptor()
this static method returns an object describing the configuration of a specific property on a given object (that is, one directly present on an object and not in the object’s prototype chain)
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor
Object.freeze()
A frozen object can no longer be changed
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze
Object.defineProperty()
defines a new property directly on an object, or modifies an existing property on an object, and returns the object.
Object.defineProperty(object1, ‘property1’, {
value: 42,
writable: false
});
get syntax
binds an object property to a function that will be called when that property is looked up
const obj = {
log: [‘a’, ‘b’, ‘c’],
get latest() {
return this.log[this.log.length - 1];
}
};
getters and setters
https://javascript.info/property-accessors
Destructuring assignment: lists
let [firstName, surname] = [“John”, “Smith”]
https://javascript.info/destructuring-assignment
CustomEvent: detail property
// create custom events
const catFound = new CustomEvent(“animalfound”, {
detail: {
name: “cat”,
},
});
// add an appropriate event listener
obj.addEventListener(“animalfound”, (e) => console.log(e.detail.name));
// dispatch custom event
obj.dispatchEvent(catFound);
https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/detail
Object.seal()
similar to Object.freeze() but you may change property values; maily, you cannot add/delete properties, but may change values of existing ones
https://devdocs.io/javascript/global_objects/object/seal
Object.assign(target, …sources)
static method copies all enumerable own properties from one or more source objects to a target object.
It returns the modified target object
(! leave the target alone) Object.assign({}, …[target, …source])
(better yet) const obj = {…{1:1, 2:2}, 3:3}
Symbol
primitive unique value. immutable.