| Function declaration | Function expression |
| Declared as a separate statement within the main JavaScript code | Created inside an expression or some other construct |
| Can be called before the function is defined | Created when the execution point reaches it; can be used only after that |
| Offers better code readability and better code organization | Used when there is a need for a conditional declaration of a function |
| Example:function abc() { return 5;} | Example:var a = function abc() { return 5;} |
Leave a Reply