0

in this example the word new why we used it?

object constructor

2nd May 2017, 6:17 PM
Shroq Khaled Mahdi Al-Nabhani
Shroq Khaled Mahdi Al-Nabhani - avatar
7 Answers
+ 3
when we want to declare for example new object, array ... example: var obj = new Object(); -----> creating object var array= new Array() ------> creating array :)
2nd May 2017, 6:22 PM
Nikola Stojiljkovic
Nikola Stojiljkovic - avatar
+ 3
because p1 and p2 are new person, and they inherit a preporties from person :) p1 and p2 are objects who inherit a preporties from object person .
2nd May 2017, 6:29 PM
Nikola Stojiljkovic
Nikola Stojiljkovic - avatar
+ 3
Nothing 😀
2nd May 2017, 6:30 PM
Nikola Stojiljkovic
Nikola Stojiljkovic - avatar
+ 1
I understand now thanks a lot😊😊😊😊
2nd May 2017, 6:27 PM
Shroq Khaled Mahdi Al-Nabhani
Shroq Khaled Mahdi Al-Nabhani - avatar
+ 1
really help me a lot😊😊😊 thank you
2nd May 2017, 6:33 PM
Shroq Khaled Mahdi Al-Nabhani
Shroq Khaled Mahdi Al-Nabhani - avatar
0
which example?
2nd May 2017, 6:18 PM
Drauchris
Drauchris - avatar
0
unction person(name, age, color) { this.a = name; this.b = age; this.c = color; } var p1 = new person("John", 42, "green"); var p2 = new person("Amy", 21, "red"); document.write(p1.b); document.write(p2.a);
2nd May 2017, 6:22 PM
Shroq Khaled Mahdi Al-Nabhani
Shroq Khaled Mahdi Al-Nabhani - avatar