Carl-Erik Kopseng
Member since Aug 20, 2014
- Profile: /members/12212-carl-erik-kopseng.htm
- URL: http://github.com/fatso83
- Comments: 2
Recent Blog Comments By Carl-Erik Kopseng
-
Extending JavaScript Arrays While Keeping Native Bracket-Notation Functionality
Posted on Aug 21, 2014 at 7:20 AM
How would one go about if trying to get this type to pass instanceOf tests? That checks on the prototype, and as you are returning an array that of course fails. "No can do" is also an answer, btw :)... read more »
-
Extending JavaScript Arrays While Keeping Native Bracket-Notation Functionality
Posted on Aug 20, 2014 at 8:13 AM
You can skip the loop by using apply in the add method: // Check to see if the item is an array. if (Array.isArray(value)) { // Add each sub-item using default push() method. Array.prototype.push.apply(this, value); } A small performa... read more »