I'm currently learning JavaScript on Codecademy. On there, it gives an example of a basic variable:
var divideByThree = function (number) {
var val = number / 3;
console.log(val);
};
However, it seems to me as if the variable inside the function is unnecessary. Would it not be possible to do this instead?:
var divideByThree = function (number) {
console.log(number/3);
};
It seems this is cutting out a whole line of code. Would the function still work and if so, why is this not used instead?