Javascript Array take(n)

Description

Javascript Array take(n)

Array.prototype.take=function(n){
    let takenArray=[];
    for(let i =0;i<n;i++){
        takenArray.push(this[i]);/*w  w w .java 2s.c  o m*/
    }
    return takenArray;
}



PreviousNext

Related