Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Underscore _.create() Function

        var x = ["a", "b", "c", "d", "e"];
  /*x = 1 would also have been valid*/
/*x.prototype is normally undefined*/
/*doesn't even seem to matter what x is as long as it exists?*/
/*the second input must be an array and the new object will be {0: firstEle, 1: secondEle} etc*/
        var new_obj = _.create(x.prototype, [10]);
        console.log(new_obj);
 
PREVIOUS NEXT
Tagged: #Underscore #Function
ADD COMMENT
Topic
Name
4+3 =