Considering the following snap of code, what is the expected result?
const gotNumber = 46;
if (gotNumber>45) {
var division = 'Second Division';
}
console.log(`Division is ${division} by number ${gotNumber}`);
Considering the following snap of code, what is the expected result?
const gotNumber = 46;
if (gotNumber>45) {
var division = 'Second Division';
}
console.log(`Division is ${division} by number ${gotNumber}`);
const gotNumber = 46;
if (gotNumber>45) {
var division = 'Second Division';
}
console.log(`Division is ${division} by number ${gotNumber}`);
Variable declared by var is function scope variable. So the variable division is accessible out of the if condition block. Ultimately the result is: Division is Second Division by number 46