-
-
Save himeshvats19/b69c942f9d33e89a680eb452f7cbd4e8 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
function calculateTotalAmount (vip) { | |
var amount = 0 // probably should also be let, but you can mix var and let | |
if (vip) { | |
let amount = 1 // first amount is still 0 | |
} | |
{ // more crazy blocks! | |
let amount = 100 // first amount is still 0 | |
{ | |
let amount = 1000 // first amount is still 0 | |
} | |
} | |
return amount | |
} | |
console.log(calculateTotalAmount(true)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment