Skip to content

Instantly share code, notes, and snippets.

@shettayyy
Last active April 30, 2020 21:43
Show Gist options
  • Save shettayyy/38cb70433053f7f584f642d7e2c12773 to your computer and use it in GitHub Desktop.
Save shettayyy/38cb70433053f7f584f642d7e2c12773 to your computer and use it in GitHub Desktop.
Double the values in the array
<!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>
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