Last active
October 7, 2022 21:15
-
-
Save ferditarakci/65ad1968a1a8de8f187ee6a2bf656612 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 = (a, b) => a * b; | |
multiply(3, 5); | |
// output: 15 | |
multiply(2, 40); | |
// output: 80 | |
// --------------------------- | |
const filtered = (arr) => arr.filter(val => 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 = (arr) => arr.map(val => val * 2); | |
double([1, 2, 3, 4, 5, 6, 7, 8, 9]); | |
// output: [2, 4, 6, 8, 10, 12, 14, 16, 18] | |
// --------------------------- | |
const isThere = (name) => ["Erik", "Elma", "Muz", "Kavun"].some(val => 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