Ad. Javascript.info part 1 Flashcards
Advanced working with functions - Recursion and stack - Rest parameters and spread operator (103 cards)
An object is a ________________.
collection of properties and has a single prototype object.
The prototype of an object may be ______ or ______
either an object or the null value
A prototype of an object is referenced by the hidden internal _________ and property
[[Prototype]]
A finite chain of objects which is used to implement inheritance and shared properties
Prototype chain
code reuse stylistics is called the
class-based inheritance
is the actual object that is used in the lookup chain to resolve methods, etc.
__proto__ or [[prototype]]
is the object that is used to build __proto__ when you create an object with new:
prototype
If the property is not found after the whole prototype chain lookup, then ________ is returned.
undefined value
Object.prototype itself also has a __proto__, which is the final link of a chain and is set to______.
null
a constructor function does another useful thing — it automatically sets a ___________ for newly created objects.
prototype object
function Foo(y) { this.y = y; }
// inherited property "x" using constructor \_\_\_\_\_\_\_\_\_\_\_\_\_\_= 10;
Foo.prototype.x
every object has a prototype
TRUE / FALSE
TRUE
An object specifies its prototype via the internal property_________
[[Prototype]]
What constitute a prototype chain are the __proto__ pointing up the chain, and the objects pointed to by __proto__, such as going from foo.__proto__, going up to foo.__proto__.__proto__, and so forth, until _______
null is reached.
By default, JavaScript engine provides the Object() funtion and an anonymous object that can be referenced to via the ________
Object.prototype.
The Object.prototype object has many built-in properties such as toString(), valueOf(), etc. It also has a property named_______ that points back to the _________
constructor
Object() function
console.log(Object.prototype.constructor !== Object); //
false
console.log(Object.prototype.constructor === Object); //
true
let point = {
x: 10,
y: 20,
};
how many properties?
how many __proto__?
2 properties
1 __proto__
Every object, when is created, receives it’s ______
prototype
If the prototype is not set explicitly, objects receive _________as their inheritance object.
default prototype
// Base object. let point = { x: 10, y: 20, };
// Inherit from `point` object. let point3D = { z: 30, \_\_proto\_\_: point, };
inherited or own
console.log( point3D.x, // 10, point3D.y, // 20, point3D.z // 30, );
inherited
inherited
own
a delegation object used to implement prototype-based inheritance.
protoype
finite chain of objects used to implement inheritance and shared properties.
prototype chain