example anonymous function in javascript
Example 1: js anonymous functions
// ES5
var multiplyES5 = function(x, y) {
return x * y;
};
// ES6
const multiplyES6 = (x, y) => { return x * y };
Example 2: anonymous function javascript
//Anonymous function; It's not assigned to an indentifier
Array.forEach((arguments) => {
//This is an anonymous function
})
function forEach(arguments) {
//This is NOT an anonymous function
}