Theme Layout

Boxed or Wide or Framed

Wide

Theme Translation

Display Featured Slider

Featured Slider Styles

Display Grid Slider

yes

Grid Slider Styles

Display Trending Posts

Display Author Bio

Display Instagram Footer

off

Dark or Light Style

Light

Blog Archive

Powered by Blogger.

Wednesday, February 22, 2017

[JavaScript] Hoisting


# JavaScript Errors - Throw and Try to Catch


Hoisting is JSP's default behavior of moving declarations to the top.

● JavaScript Declarations are Hoisted

In JavaScript, a variable can be declared after it has been used.
In other words, a variable can be used before it has been declared.


Hoisting is JavaScript's default behavior of moving all declarations to the top of the current scope.

● JavaScript Initializations are Not Hoisted

JavaScript only hoists declarations, not initializations.
below two examples are similar, But result is different.



This because only the declaration ( var y), not the initialization (=7) is hoisted to the top.
Because of hoisting, y has been declared before it is used, but because initializations are not hoisted, the value of y is undefined.

QuickEdit
Unknown
0 Comments
Share This Post :

You Might Also Like

No comments:

Post a Comment

Follow @SunriseSunsetBlog