new array

0 danial saufi · December 30, 2014
im watching buckys javascript tutorial.. i dont know if i somehow missed it or something but why do we have to write NEW in front of array like this one:
var arr = new array(1,2,3)


Post a Reply

Replies

Oldest  Newest  Rating
+1 Jay Deshaun · December 30, 2014
It tells JavaScript to create a new 'Array' , which 'new' is required in-order to create the new array.
I wouldn't suggest using the built-in array constructor.

http://www.w3schools.com/js/js_arrays.asp
http://www.w3schools.com/js/tryit.asp?filename=tryjs_array_new
0 Jay Deshaun · January 27, 2015
No Problem :)
0 danial saufi · December 31, 2014
thx dude.. u replied both of my question. appreciated alot:)
  • 1

Javascript

107,332 followers
About

A scripting language that is added to standard HTML to create interactive effects, apps, games for the browser.

Links
Moderators