var result = add(10, 20);
console.log(result); // 30

// Function declaration
function add(num1, num2) {
	return num1 + num2;
}
// Function expression
var add = function (num1, num2) {
	return num1 + num2;
};

Function declarations are hoisted to the top of the code by the browser before any code is executed. Specifically, all of the functions written with function declarations are “known” before any code is run. This allows you to call a function before you declare.

Function expressions, however, do not hoist. If you try to run a function before you’ve expressed it, you’ll get an error.

References