Ways to create functions
5 Ways
Function Declarations
Function Expressions
Function constructor
Syntax
Fat Arrow Functions
Syntax
x = x + y;
return x;
}
// If function only has 1 statement, we can remove brackets and return keyword
(x, y) => x
// If function only has 1 argument, we can remove the parens
y => x
Method Definitions
myFunc: function( ) { },
myFunc2( ) { }
}