When setting a variable to reference a function in a multi-line declaration, should it be followed by a semicolon. Take the folling for example:
function sayHi(name) {
(window.console && console.log || alert)('Hello ' + name);
}
var sayBye = function(name) {
(window.console && console.log || alert)('Cya ' + name);
};
Should there be a semicolon after the second declaration as it fits with a var keyword, on the other hand, function definitions don’t usually have a semicolon at the end.
The first function is a function declaration, not a statement.
It does not need a semicolon.
The second function is a regular statement that happens to involve a function expression.
Like all other statements, it should end with an optional semicolon.