Functions

Anonymous Functions in JavaScript

Used to declare and call a function at once.


Syntax
function(passedParams){
    //code to execute
    return value;
}

Notes

Anonymous functions do not have a functionName identifier. They often have a return statement and are passed into other functions, objects, or even arrays.


Example
var findMaximum = function(a,b){ //function declared and called inline
    return (a > b) ? a : b;
}

See Also
Documentation

Functions - JavaScript | MDN

Add to Slack

< Function Declaration   |   Closures >

© 2018 SyntaxDB. All Rights Reserved.