I understand that in JavaScript only function declarations are hoisted, meaning it should print 30 after executing the function sum.
However, I am confused because it is saying diff is not defined. Shouldn't it have been hoisted as well?
sum(10, 20);
diff(10, 20);
function sum(x, y) {
return x + y;
}
let diff = function(x, y) {
return x - y;
}