Function Hoisting

Dear Sciaku Learner you are not logged in or not enrolled in this course.

Please Click on login or enroll now button.

If you have any query feel free to chat us!

Happy Coding! Happy Learning!

Lecture 136:- Function Hoisting

Function hoisting is a JavaScript mechanism where function declarations are moved to the top of their scope before code execution. This means that functions can be called before they are declared in the code.

For example:

scssCopy code

foo(); // Output: "Hello world!" function foo() {  console.log("Hello world!"); }

In the above code snippet, the foo function is called before it is declared. However, since function declarations are hoisted to the top of their scope, the function is executed successfully and the output is "Hello world!".

It's important to note that function hoisting only applies to function declarations, not function expressions. Function expressions are not hoisted and will result in a ReferenceError if they are called before they are declared.

16. JavaScript - Functions and Array

2 Comments

@niteshguptav63
niteshguptav63 Nov 17, 2024 at 1:39 PM

I am not able to access videos from second class and further. I have already completed first class

@niteshguptav63
niteshguptav63 Nov 16, 2024 at 10:56 AM

When will I get my course?

@admin79
admin79 Nov 17, 2024 at 1:29 PM

Now, Your query was resolved.

Frequently Asked Questions About Sciaku Courses & Services

Quick answers to common questions about our courses, quizzes, and learning platform

Didn't find what you're looking for?

help_center Contact Support