So should I be using traditional function expressions using the `function` keyword or arrow functions?


#1

Question

So should I be using traditional function expressions using the function keyword or arrow functions?

Answer

For the most part it is recommended to use arrow function when possible for readability purposes. However, there are a few cases where it is more advantageous to use the function keyword over the arrow function. We haven’t covered these use cases yet so don’t worry about them now but for those curious, arrow functions to not have their own binding for this and arguments keywords, thus they use the bindings associated with whatever environment is currently executing the code. Not something to currently worry about but something to keep in mind for the future.