Is it a just a standard to declare an inline function as const or there is a advantage that I am missing?
Can ‘let’ be used?
PS: it would be nice to talk about what are anonymous /inline functions in the basic JS section instead of dropping in the middle of ES6. it is so confusing.
Challenge: Use Arrow Functions to Write Concise Anonymous Functions
You can use let in theory… but you should always use const for any variable you declare unless you plan on changing the contents of the variable, in which case you should use let instead. You don’t want to overwrite what your function does - so we use const instead of let.
Thank you.
I think I will get a better understanding as I progress in JavaScript.
But in practice and in general, I should use const to declare variables / functions to avoid side effects and changes to variables / code.