Quiz 1 Flashcards
temporal dead zone
When you try to access a variable before it has been declared/the “area”/time between the start of a scope and when a variable is actually declared
What is an object?
An object is a container of properties
What are properties and what can they contain?
Properties belong to objects and have names/“key” and values. They can take any values including other objects and functions
What is a prototype?
Inherited properties from another object is called a prototype
What is the highest level of a prototype
Object.prototype
What is the prototype of “hello” and the prototype of that prototype?
- String.prototype 2. Object.prototype
A property is found by first looking if the object itself contains the property then that object’s prototype and so on until……
it reached an object will null as the prototype such as Object.prototype
Give an example of two methods that Object.prototype contains
toString and hasOwnProperty
Give an example of two object that Object.prototype contains
String.prototype and Array.prototype
Object.create
Object.create(otherObject)
Used to create objects with a specified prototype
What does using this.object do when using a constructor?
Creates a property name and value for every new object instantiated with the constructor
i.e.
this.names = [‘jane’, ‘mary’]
c = new Name
d = new Name
c.names will = jane
d.names will = mary
hasOwnProperty vs this.object
hasOwnProperty can set properties by inheriting, and this.object creates new/original properties
Asynchronous programming allows…?
Allows multiple things to run at the same time. Allows part of code to start now, and finish later
What is a callback function?
A function that’s passed into another function, that when called will be called with the result
What is a higher order function?
A function that takes a function(s) as a parameter, or that returns a function