Difference in functions


#1

Hello guys, i was learning the functions in Javascript, but i wondered
What’s the difference between

function getPizza(type, topping) {...}

And…

const getPizza = (type, topping) => {...};

They’re both functions, but i don’t understand the difference…


#2

we have function statements and function declarations, which you can read about here:

the arrow function expression you use (with const was introduced in es6 (which was released in 2015), its a shorter version of the function expression


#3

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