Say I have a piece of code like this:
const number = 3;
function fooFunction() {
let numberTwo = 5;
var answer = number + numberTwo;
return answer;
}
finalAnswer = fooFunction();
console.log(finalAnswer);
Assuming an ES2015 compatible browser, what would be the advantages/disadvantages of using the above code, over:
const number = 3;
function fooFunction() {
var numberTwo = 5;
var answer = number + numberTwo;
return answer;
}
finalAnswer = fooFunction();
console.log(finalAnswer);
Are there any advantages or disadvantages, given they both return the same number?