Skip to content

Instantly share code, notes, and snippets.

@himeshvats19
Created June 26, 2019 07:08
Show Gist options
  • Save himeshvats19/b69c942f9d33e89a680eb452f7cbd4e8 to your computer and use it in GitHub Desktop.
Save himeshvats19/b69c942f9d33e89a680eb452f7cbd4e8 to your computer and use it in GitHub Desktop.
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