Created
July 10, 2020 13:04
-
-
Save rishisidhu/41de55d3098b879b8ad9ed3f9aadff00 to your computer and use it in GitHub Desktop.
Modern JS ES6+ features - Default Parameters
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
//Default parameter z | |
var sum = function (x, y, z = 10) { | |
return x + y + z; | |
}; | |
console.log(`Sum = ${sum(10, 20)}`); | |
console.log(`Sum = ${sum(10, 20, 5)}`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment