Created
September 11, 2019 01:48
-
-
Save meidikawardana/0e9a6b73fde06d28149e534a21eddabd to your computer and use it in GitHub Desktop.
next gen js - using map function
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 charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
"use strict"; | |
var numbers = [1, 2, 3]; | |
var doubleNumArray = numbers.map(function (num) { | |
return num * 2; | |
}); | |
console.log(numbers); | |
console.log(doubleNumArray); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">const numbers = [1,2,3]; | |
const doubleNumArray = numbers.map((num) => { | |
return num * 2; | |
}); | |
console.log(numbers); | |
console.log(doubleNumArray); | |
</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
"use strict"; | |
var numbers = [1, 2, 3]; | |
var doubleNumArray = numbers.map(function (num) { | |
return num * 2; | |
}); | |
console.log(numbers); | |
console.log(doubleNumArray); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment