Created
May 15, 2023 16:05
-
-
Save suhailgupta03/10e6f8d4b0f97bb0baa61df1172fa410 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
| function greet(message, username) { | |
| // undefined are FALSY values in JS | |
| // !undefined means !false -> true | |
| if(!username) { // if username is not yet defined | |
| username = "user"; // we are assinging it some value | |
| } | |
| var greetMessage = `Hello, ${username}! ${message}`; | |
| console.log(greetMessage); | |
| } | |
| greet("Good evening"); | |
| greet("Good evening", "arjun"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment