My first thought was, wouldn't it be cool to have a formula that stays the same but you could mask some of the variables with new values before running it! But if that masking happens conditionally in an if statement, then the variable will just revert back to their original values when the execution leaves the if and we're right back to where we started.
BTW, the above code works with const too!
{
const i = 3;
{
const i = 29; // <-- This is a new variable and masks the original
console.log(i); // <-- Will print 29
}
console.log(i); // <-- Back to the original variable, will print 3
}
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
My first thought was, wouldn't it be cool to have a formula that stays the same but you could mask some of the variables with new values before running it! But if that masking happens conditionally in an
if
statement, then the variable will just revert back to their original values when the execution leaves theif
and we're right back to where we started.BTW, the above code works with
const
too!