Javascript Array normalize()

Description

Javascript Array normalize()


Array.prototype.normalize = function() {
    debugger;/*w  w w .ja  va2s  . c  om*/
    var Self = this;
    for(var i=0; i<Self.length; i++){
        var t = Self.splice(i,1)[0];
        if (!Array.isArray(t))
            Self.splice(i,0,t);
        else
            t.reverse().forEach(function(a){
                Self.splice(i,0,a);
            });
    }
    return Self;
};



PreviousNext

Related