Created
June 20, 2021 03:32
-
-
Save pszponder/8a406d88fead2518fea409b030fd357d 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
// Define variable x and initialize its value to 1 | |
let x = 1; | |
// Define function that will console.log the value of x | |
function myFunc() { | |
console.log(x); | |
} | |
// Define function that defines a local variable x = 50 and calls myFunc() | |
function logVariable() { | |
let x = 50; | |
myFunc(); | |
} | |
// What will logVariable() return? 1, 50, something else? | |
logVariable(); // This will log 1 to the javascript console |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment