Push to append element to array - Node.js Array

Node.js examples for Array:Array Value

Description

Push to append element to array

Demo Code


Array.prototype.append = function(value) {

    if (value instanceof Array) {
        for (var i = 0, l = value.length; i < l; i++) {
            this.push(value[i]);//from  w w w  .j a  v  a  2  s. c  om
        }
    } else {
        return this.push(value);
    }
};

Related Tutorials