What I found by reading source code Flashcards

1
Q

Static method

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Object.getOwnPropertyDescriptor()

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Object.freeze()

A

A frozen object can no longer be changed

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Object.defineProperty()

A

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
});

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

get syntax

A

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];
}
};

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

getters and setters

A

https://javascript.info/property-accessors

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Destructuring assignment: lists

A

let [firstName, surname] = [“John”, “Smith”]

https://javascript.info/destructuring-assignment

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

CustomEvent: detail property

A

// 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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Object.seal()

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Object.assign(target, …sources)

A

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}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Symbol

A

primitive unique value. immutable.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly