This media is not supported in your browser
VIEW IN TELEGRAM
Explanation 🕵️♂️📝
The first console.log(number) will output 7. This might be unexpected due to the use of var. In JavaScript, variables declared with var are function-scoped or globally-scoped, not block-scoped. Therefore, the inner block reassigns the value of the existing number variable declared outside the block.
The second console.log(firstName) will output "Thunder". This is because the let firstName inside the block is block-scoped and does not affect the outer variable with the same name. The inner firstName variable only exists within the block where it is declared.
Share your response below! 💬✨
@_shakya.07 #thundercoding
Please kindly tag any friends who may find this information valuable! 🙏
•
•
📲 Turn on post notifications to get the latest updates
#ThunderCoding #JavaScriptExploration #HTMLSecrets #CodeMagic #WebDevJourney #ScriptTagRevelation #CodingAdventure #TechWizardry #LearnToCode #JavaScriptMagic #javascript
The first console.log(number) will output 7. This might be unexpected due to the use of var. In JavaScript, variables declared with var are function-scoped or globally-scoped, not block-scoped. Therefore, the inner block reassigns the value of the existing number variable declared outside the block.
The second console.log(firstName) will output "Thunder". This is because the let firstName inside the block is block-scoped and does not affect the outer variable with the same name. The inner firstName variable only exists within the block where it is declared.
Share your response below! 💬✨
@_shakya.07 #thundercoding
Please kindly tag any friends who may find this information valuable! 🙏
•
•
📲 Turn on post notifications to get the latest updates
#ThunderCoding #JavaScriptExploration #HTMLSecrets #CodeMagic #WebDevJourney #ScriptTagRevelation #CodingAdventure #TechWizardry #LearnToCode #JavaScriptMagic #javascript
👍7🔥3❤2😁1