Omit the new
to make apply
work (otherwise it would be interpreted as new (Array.apply)(…)
). Since the Array
constructor doesn't require a new
and can be called as a function as well, it would be as simple as:
array1 = new Array('orange', 'red', 'blue', 'green');
array2 = Array.apply(this, array1);
Related question: Use of .apply() with 'new' operator. Is this possible?
However, you shouldn't need to use the Array constructor at all, especially because it doesn't work well with single-numeric-element arrays. Better:
var array1 = ['orange', 'red', 'blue', 'green'];
var array2 = array1.slice();