Bubble Foundry


Posts tagged with: constructors

Javascript Constructors with an Array of Parameters
Say we have: function myObj() { this.input = Array.prototype.slice.call(arguments); } We can pass a variable or an array but : var myObj1 = new myObj(1); myObj1.input // -> [1] var myArr = [1, 2, 3]; var myObj2 = new myObj(myArr); myObj2.input // -> [[1, 2, 3]] How then can we get, while still using myArr: […] Read more – ‘Javascript Constructors with an Array of Parameters’.