Extends the array with another - Node.js Array

Node.js examples for Array:Array Value

Description

Extends the array with another

Demo Code

/**//from   ww  w .  j  a va2s .  c  om
 * Extends the array with another
 * @param {Array} arr
 * @version 1.0.0
 * @date March 25, 2011
 * @since March 25, 2011
 * @package jquery-sparkle {@link http://www.balupton/projects/jquery-sparkle}
 * @author Benjamin "balupton" Lupton {@link http://www.balupton.com}
 * @copyright (c) 2011 Benjamin Arthur Lupton {@link http://www.balupton.com}
 * @license MIT License {@link http://creativecommons.org/licenses/MIT/}
 */
Array.prototype.extend = function(arr){
  for (var i = 0; i < arr.length; ++i) {
    this.push(arr[i]);
  }
  return this;
}

Related Tutorials