Feeling Invincible in God

Within five days of digging deeper into the Bible, asking deeper questions, setting the time to put the right mindset with God, God has really worked through me in ways I didn’t expect. I’ve been…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Beginner Guide of Hoisting in JavaScript.

In any front-end developer interview, Interviewer most of the time ask about the hoisting of JavaScript, and sometime you don’t know about the hoisting , so here the guide about hoisting in JavaScript.

Hoisting is the process in which JavaScript interpreter move the declaration of function ,variable, class at the top of the scope prior to execution of code.
Hoisting provide us early access of function ,variable, class, before it’s declaration. user can access the function ,variable, class before it’s declaration.
In JavaScript, hoisting is available for the declaration, not for Initialization.
when user try to access the variable before it’s declaration he’ll get the undefined, because as I said JavaScript only hoist declaration not the initialization, Initialization is only done when line of initializing code is execute.

Hoisting in function gives us one of the major advantage, user can call the function before it’s declaration.
Hoisting is only work for the Named function, Anonymous type of function like fat arrow function doesn’t have Hoisting property.

Hoisting in variable is only work for declaration, not for initializing.
early access of variable before initialize it gives us undefined.
let, const variable doesn’t have the hoisting property, only var variable follow the declaration hoisting property.

Class Hoisting is only hoist the declaration, Initialize Hoisting doesn’t work on class hoisting. which means when JavaScript Interpreter find the reference of the class before it’s initialize, we’ll get the Reference Error.

Add a comment

Related posts:

Justice League Vs Suicide Squad

I love picking up things like this on Netgalley, it really cheers me up. I’ve kind of given away what I think about the book haven’t I? Never mind, carry on and listen to my waffle anyway. While I’m…

Why PhoneSuite keep on Upgrading its Online Security?

Because of security risks and cyber-attacks in today’s environment, cybersecurity is critical. Many firms create software to secure data. This program safeguards the data. That is why PhoneSuite is…

Calorie Intake on Average

Knowing how many calories your body needs is a good starting point for any weight-management plan, whether your goal is to lose weight, gain weight, or maintain your current weight. The USDA compiles…