0

Why do we use" new" before ARRAY and DATE in declaration??

17th Aug 2017, 6:00 AM
J.SAIKIRAN
J.SAIKIRAN  - avatar
3 Answers
0
Because Date is a constructor. To create a constructor like that: function Obj(text) { this.text = text; change = function() { this.text = "some text"; } } //to create a new Obj: var obj = new Obj();
17th Aug 2017, 7:27 AM
Î‘Î·Ï„ÎżÎčπe
Î‘Î·Ï„ÎżÎčπe - avatar
0
what happens if we don't use "new"
17th Aug 2017, 1:09 PM
J.SAIKIRAN
J.SAIKIRAN  - avatar
0
It don't works (I suppose)
17th Aug 2017, 6:05 PM
Î‘Î·Ï„ÎżÎčπe
Î‘Î·Ï„ÎżÎčπe - avatar