Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
August 28, 2017 02:06 pm GMT

JavaScript Scope and Closures

Scopes and closures are important in JavaScript. But, they were confusing for me when I first started. Here's an explanation of scopes and closures to help you understand what they are.

Let's start with scopes.

Scope

A scope in JavaScript defines what variables you have access to. There are two kinds of scope global scope and local scope.

Global scope

If a variable is declared outside all functions or curly braces ({}), it is said to be …


JavaScript Scope and Closures is a post from CSS-Tricks


Original Link: https://css-tricks.com/javascript-scope-closures/

Share this article:    Share on Facebook
View Full Article

CSS Tricks

A Web Design Community curated by Chris Coyier

More About this Source Visit CSS Tricks