Created
August 22, 2020 12:13
-
-
Save iamsaief/1c689b029c0b940b2f3ee78a504325ba to your computer and use it in GitHub Desktop.
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
/* Arrow functions - implicit return*/ | |
const doubleIt = (num) => num * 2; | |
console.log(doubleIt(4)); | |
// Output: 8 | |
const add = (a, b) => a + b; | |
console.log(add(40, 50)); | |
// Output: 90 | |
/* explicit return */ | |
const sumTimesDifference = (x, y) => { | |
const sum = x + y; | |
const diff = x - y; | |
return sum * diff; | |
}; | |
console.log(sumTimesDifference(20, 10)); | |
// Output: 300 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment