From the course: Master Next.js: Elaborate Hands-On Web Development, React Basics, Advanced Next.js, and Deployment

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

What is function hoisting in JavaScript?

What is function hoisting in JavaScript?

Let's make a new file. So we have a new lesson. Let's learn about function hoisting. I know the last lesson was pretty intense. So this is going to be a little bit more fun and chill, but it's going to continue to solidify our fundamentals for functions. So we're going to call it function hoisting. We'll save it wherever you can access it with your terminal. Let's clear the terminal up. Oops. Open up my terminal and clear it from our last lesson. And let's learn about function hoisting. So function hoisting is interesting to learn because it also helps to solidify how JavaScript works as well. So we can say that JavaScript essentially interprets, or we can say the JavaScript interpreter, because remember, we write JavaScript, and then the engines then compile it down. So the JavaScript interpreter that's interpreting our JavaScript hoists our function declarations to the top of the current scope. We'll talk more about scope in the next lesson to get deeper with scope. When we just…

Contents