Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

function that duplicates data in array js

function doubleValues(array) {
  var newArray = [];
  array.forEach(function (el) { newArray.push(el, el); });    
  return newArray;
}

console.log(doubleValues([1,2,3]));
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #function #duplicates #data #array #js
ADD COMMENT
Topic
Name
5+6 =