+ 1
What does the "new" mean in the example of adding methods??
p = new function_name()
3 odpowiedzi
0
function person(name, age) {
this.name= name;
this.age = age;
this.yearOfBirth = bornYear;
}
var p = new person("A", 22);
"new" is used to create a new instance of the person object and assigns it to "p" variable.
The result is:
p.name is initialized to "A"
p.age is initialized to 22
0
p = new function_name()
"new" creates an instance of function_name object
"=" is used to assign the created instance of function_name to "p"
0
What is it betwen x and 2