Facebook Pixel
Function Statement vs Function Expression in JavaScript

Is an arrow function a declaration or an expression in JavaScript?

The answer

Always an expression. Arrow functions are always assigned to a variable. They are hoisted as variables, not as functions, and they do not have their own this or arguments.

More FAQs in Function Statement vs Function Expression in JavaScript

A function statement (declaration) is hoisted with its full body, so it can be called before the line. A function expression is assigned to a variable, which is hoisted (undefined with var, TDZ with let/const) but the function body is only assigned at the line.

No. With var, calling it early throws TypeError because the variable is undefined. With let or const, it throws ReferenceError because the variable is in the Temporal Dead Zone.

Because function declarations are hoisted with their entire body during the memory allocation phase. The engine stores the full function in memory before any code runs, so calling it before the line works.

Still have questions?

Browse all our FAQs or reach out to our support team

Want to upskill yourself?

Your learning library

Small steps. Big possibilities.

Find your next course. Build something great.

Our courses are taking a Coffee break, but your curiosity shouldn't. Stay engaged with namastedev linkedin, youtube, discord and other resources while you wait.

0
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.