So does someone have an example of why I’d ever want to use a function expression over a function declaration?
I’m a little confused as to the application for Function Expressions, at least in the way it’s being shown in the exercise and my current understanding.
At a glance it appears redundant to declare a variable to hold a function when a function can just be declared on it’s own. Is it maybe related to memory usage throughout a larger program?
I think an example of a practical use case would set me straight.
Insight would be appreciated.
This is an article from 2015, before arrow functions were adopted into regular use, but it can apply to them, as well, for the most part.
As we’ve seen, function expressions don’t offer much that can’t be achieved with function declarations, but using them can often result in cleaner and more readable code. Their widespread use makes them an essential part of every developer’s toolbox.