Is the arrow function declaration the norm?

So, coming from some basic knowledge of C++ and Unreal Engine coding, I am very curious about the arrow function call/declaration.

Is the — const functionname = () => — way the norm, or just the way Codecademy prefers to teach?

is the — function functionname{} — still okay to use and take with me to a possible career, or should I get used to using the arrow function way of doing it?

Thanks in advance, and I’m really enjoying the way the content is taught. WAY WAY WAY better than DataCamp, just sayin’.

I would use the arrow declaration, this feature was introduced in 2015 in JavaScript update. Javascript kept the “old” syntax as well (making breaking changes to the web would be a disaster)

const is block-scoped, furthermore const prevents accidental re-assignment:

function functionname() {
   // body of function
} 

functionname = 5
console.log(functionname) 

while using const/arrow function would give an error.

1 Like

Thank you :grinning: