Syntax difference


During the functions course in codeAcademy we learn:

const variableName = () = >

However, when I google functions javasscript I often find this:

function variableName(n)

Will this be covered in future exersises? And if not, why / how is this different?


look at this documentation:

it explains the two ways we can declare functions: Function expressions and Function declarations

You can read about them.

const variableName = () = > is a function expression, where as function variableName(n) is a function declaration. When to use which, is up to the developer. Learn there differences

to make matters more complicated (simple things are boring), you use es6 (the latest version of javascript) which allows to shorten is the function expression (among other things)


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.