Last active
August 29, 2015 14:07
-
-
Save colintoh/1712726f87ef98a1771f 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
//Without Default Parameters | |
function sell(seller, price){ | |
price = price || 2; | |
seller = seller || "John"; | |
console.log(seller + " is selling at $"+price); | |
} | |
//With Default Parameters | |
function sellWithDefault(seller = "John", price = 2){ | |
console.log(seller + " is selling at $"+price); | |
} | |
sell(); // John is selling at $2 | |
sellWithDefault(); // John is selling at $2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment