In JavaScript a function can be declared in two ways.
The first way is to simply declare the
function via function
, immediately
giving its name:
function func() {
console.log('!');
}
func(); // shows '!'
The second way is to make an unnamed function and write it to some variable:
let func = function() {
console.log('!');
};
func(); // shows '!'
Scientifically, the first method is called Function Declaration, and the second - Function Expression.
Determine if the presented function is a Function Declaration or a Function Expression:
function func() {
console.log('!');
}
Determine if the presented function is a Function Declaration or a Function Expression:
let func = function() {
console.log('!');
}