Last active
April 30, 2020 21:43
-
-
Save shettayyy/38cb70433053f7f584f642d7e2c12773 to your computer and use it in GitHub Desktop.
Double the values in the array
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="description" content="[add your bin description]"> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
const double = (arr) => { | |
const newArr = []; | |
for(let i = 0; i < arr.length; i++) { | |
newArr.push(arr[i] * 2); | |
} | |
return newArr; | |
} | |
console.log(double([1, 2, 3])); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">const double = (arr) => { | |
const newArr = []; | |
for(let i = 0; i < arr.length; i++) { | |
newArr.push(arr[i] * 2); | |
} | |
return newArr; | |
} | |
console.log(double([1, 2, 3]));</script></body> | |
</html> |
This file contains hidden or 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 double = (arr) => { | |
const newArr = []; | |
for(let i = 0; i < arr.length; i++) { | |
newArr.push(arr[i] * 2); | |
} | |
return newArr; | |
} | |
console.log(double([1, 2, 3])); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment