Level 35 Level 37
Level 36

[Quiz] Objects

25 words 0 ignored

Ready to learn       Ready to review

Ignore words

Check the boxes below to ignore/unignore words, then click save at the bottom. Ignored words will never appear in any learning session.

All None

Every JavaScript object has a prototype.
What does every object have in js?
The prototype is also an object.
What type of container is the prototype?
Where do all js objects inherit their properties and methods?
All JavaScript objects inherit their properties and methods from their prototype.
What is an object prototype?
it is a constructor function which can be used as base for as many objects as we want.
How do we create a prototype?
The standard way to create an object prototype is to use an object constructor function:
Why do we all prototype?
maybe because we create one and from that one we can create many.
What is the advantage of using a constructor function?
With a constructor function, you can use the new keyword to create new objects from the same prototype:
How to create many from that one?
var myFather = new person("John", "Doe", 50, "blue");
What do we call a prototype?
The constructor function is the prototype for your person objects.
Sometimes you want to add new properties (or methods) to an existing object.
In what cases do we want to add properties or methods to an object?
myFather.nationality = "English";
Adding a new property to an existing object is easy:
To which object will "English" be added?
The property will be added to myFather. Not to myMother. Not to any other person objects.
myFather.name = function () {
Adding a new method to an existing object is also easy:
what is way 1?
To add a new property to a constructor, you must add it to the constructor function:
Prototype properties
What kind of properties do we define in the constructor function?
(default values).
What kind of values do we consider the values of prototype properties?
function person(first, last, age, eyecolor) {
how to define a method in the constructor function?
What does prototype property allow us to do?
The JavaScript prototype property allows you to add new properties to an existing prototype:The JavaScript prototype property also allows you to add new methods to an existing prototype:
Can you modify default values in the prototype with prototype value?
yes but Only modify your own prototypes. Never modify the prototypes of standard JavaScript objects.
What are the most important part of the js objects?
Properties are the most important part of any JavaScript object.
What are properties?
Properties are the values associated with a JavaScript object.
What is an object?
collection of properties, where each property has name and value
Can properties be changed, added and deleted?
Properties can usually be changed, added, and deleted, but some are read only.
objectName.property // person.age
What is The syntax for accessing the property of an object?
How can we loop through an object?
The JavaScript for...in statement loops through the properties of an object.