Last active
October 7, 2022 21:15
-
-
Save ferditarakci/24b38b0937326bbe2c787e43fa055151 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 multiply = function(a, b) { | |
return a * b; | |
} | |
multiply(3, 5); | |
// output: 15 | |
multiply(2, 40); | |
// output: 80 | |
// --------------------------- | |
const filtered = function(arr) { | |
return arr.filter(function(val) { | |
return val > 4; | |
}) | |
} | |
filtered([1, 2, 3, 4, 5, 6, 7, 8, 9]); | |
// output: [5, 6, 7, 8, 9] | |
filtered([1, 2, 3, 4]); | |
// output: [] | |
// --------------------------- | |
const double = function(arr) { | |
return arr.map(function(val) { | |
return val * 2; | |
}) | |
} | |
double([1, 2, 3, 4, 5, 6, 7, 8, 9]); | |
// output: [2, 4, 6, 8, 10, 12, 14, 16, 18] | |
// --------------------------- | |
const isThere = function(name) { | |
const arr = ["Erik", "Elma", "Muz", "Kavun"]; | |
return arr.some(function(val) { | |
return val === name; | |
}) | |
} | |
isThere("Elma"); | |
// output: true | |
isThere("Çilek"); | |
// output: false | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment