JavaScript take part of an array

Viewed 57879

How can I create a new array that contains all elements numbered nth to (n+k)th from an old array?

5 Answers

Prototype Solution:

Array.prototype.take = function (count) {
    return this.slice(0, count);
}
Related