how to double array data in js

Solutions on MaxInterview for how to double array data in js by the best coders in the world

showing results for - "how to double array data in js"
Niklas
24 Jan 2020
1function double (arr){
2    let newArr = [];
3    for(let i = 0; i < arr.length; i++){
4        newArr.push(arr[i] * 2);
5    }
6    console.log(newArr) ;
7}
8console.log(double([3,4,5]));
9