34 Flashcards
(2 cards)
1
Q
Main Difference Function Declaration vs. Function Expression
A
You can call function declarations before they are defined but with function expressions it’s impossible. (Hoisting)
2
Q
When to use function declarations and when function expressions?
A
- Use function declarations when you want to create a function on the global scope and make it available throughout your code
- Use function expressions to limit where the function is available, keep your global scope light, and maintain clean syntax.