console.log(add(2, 3));
var add = function(a, b) {
return a + b;
};
The output will be `TypeError: add is not a function`. This error occurs due to how variable hoisting works with function expressions. When JavaScript processes this code, it hoists the variable declaration `var add` to the top of the scope, but not the function assignment. So at the point where `console.log(add(2, 3))` is executed, `add` exists as a variable but its value is `undefined`, not a function. Therefore, attempting to call it as a function results in a TypeError. This is different from function declarations (e.g., `function add(a, b) { return a + b; }`), which are hoisted completely and can be called before their declaration in the code. This example demonstrates one of the key practical differences between function declarations and expressions: expressions cannot be used before they appear in the code, while declarations can.