Created
May 24, 2019 17:48
-
-
Save rahmatrhd/3bda42c1acaeaf94b721c8292b3cb735 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
// map | |
var animals = ['ayam', 'sapi', 'bebek'] | |
function digoreng(daging) { | |
return daging + ' goreng' | |
} | |
// var foods = animals.map(digoreng) | |
var foods = animals.map(function(daging) { | |
return daging + ' goreng' | |
}) | |
console.log(foods) | |
// filter | |
var numbers = [1, 3, 6, 7, 8, 9] | |
function isEvenNumber(n) { | |
return n % 2 === 0 | |
} | |
var evenNumbers = numbers.filter(isEvenNumber) | |
console.log('evenNumbers', evenNumbers) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment