Function declarations, sometimes called function statements, define a function by using the function
keyword.
function foo(n) { return n; }
Functions that are declared with this syntax are hoisted to the top of the current scope. What this actually means is that, even if the function is defined several lines down, JavaScript knows about it and can use it earlier in the scope. For example, the following will correctly print 6 to the console:
foo(2,3); function foo(n, m) { console.log(n*m); }