Last active
December 26, 2021 09:48
-
-
Save 73nko/ca1e0f345e2f51cca092dc0f5e037e62 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const array = [1, 2, 3, 4, 5]; | |
function copyAndMultiplyBy2(array) { | |
var newArray = []; | |
for (var i = 0; i < array.length; i++) { | |
newArray.push(array[i] * 2); | |
} | |
return newArray; | |
} | |
function copyAndDivideBy2(array) { | |
var newArray = []; | |
for (var i = 0; i < array.length; i++) { | |
newArray.push(array[i] / 2); | |
} | |
return newArray; | |
} | |
const arrayMultiplied = copyAndMultiplyBy2(array); | |
const arrayDivided = copyAndDivideBy2(array); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment