
Function Declaration vs Function Expression: What’s the Difference?
Topics To Cover What functions are and why we need them Function declaration syntax Function expression syntax Key differences between declaration and expression Basic idea of hoisting (very high level) When to use each type What functions are and why we need them A function in programming is the self-contained, named block of code it used to perform a specific task. Its like a sub-programm or black-box which take some input, process it and return a output. Think it like a vending machine: Input (arguments): it take some mony the input and punch button start running. Body (function): its internal machanics of the vending machine. it identify is stock available and which item need to drop, calculate changes mony. Output (return value): machine drop item and changes in the slot. Why we need it? You dont need to knwo how to build the vending machine every time when you need snacks, its electronics, complex coin slote mechanics. You only need to know how to use its interface. Function decl
Continue reading on Dev.to
Opens in a new tab


