Const - arrow functions

Does anybody know, why an arrow function needs “const” in the beginning or why it is “const” instead of “let” or “var”?

Since the pararmeters used in a function change value I am a bit irritated by this.

Thanks for any reply!

const says something about the function itself, not the parameters.

by declaring the function with const, you can accidentally redefine the function variable:

const example = () => 'hello world'
example = 're-assign' // error

if you do need to re-assign the function (not very common, but not impossible either) you should use let or var (preferable let)

2 Likes

Thank you! This clarifies it for me.