How to triple array values in JavaScript

1 Answer

0 votes
function tripleValues(arr){
    return arr.map((num) => num * 3);
}

console.log(tripleValues([1,2,3,4,5,6]));


/*
run:

[3, 6, 9, 12, 15, 18] 

*/

 



answered May 20, 2021 by avibootz
edited May 20, 2021 by avibootz
...