Created
August 3, 2023 15:19
-
-
Save suhailgupta03/3f3c35cd4a249cd8d7c579328bd575a3 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 sum(a, b) { | |
let sum = a + b; | |
return sum; | |
// role of return is to "return" the | |
// value of sum to the caller | |
} | |
function isUserLoggedIn() { | |
let user = { | |
name: "John", | |
loggedIn: true | |
} | |
return user.loggedIn; | |
} | |
// let x = 300 | |
// or to write this using function you can | |
// write as follows | |
let x = sum(100, 200); | |
console.log(x); | |
let y = sum(10, 100); | |
console.log(y); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment