Take value from Array - Node.js Array

Node.js examples for Array:Array Value

Description

Take value from Array

Demo Code

Array.prototype.take = function (count) {
    var items = new Array();
    for (var i = 0; i < this.length && i < count; i++) {
        items.push(this[i]);/*from w w  w  .  j  a  va 2 s. com*/
    }
    return items;
};

Related Tutorials