javascript copy an array
let arr =["a","b","c"];
// ES6 way
const copy = [...arr];
// older method
const copy = Array.from(arr);
javascript copy an array
let arr =["a","b","c"];
// ES6 way
const copy = [...arr];
// older method
const copy = Array.from(arr);
java copy array
int[] a = {1,2,3,4,5};
int[] b = Arrays.copyOf(a, a.length);
javascript duplicate an array
let arr =["a","b","c"];
// ES6 way
const duplicate = [...arr];
// older method
const duplicate = Array.from(arr);
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]));
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us