Variable Accessibility in JavaScript

Variable Accessibility in JavaScript

Variable Accessibility in JavaScript

Variable accessibility means how many ways to access the the variable. Its depends on scope of the variable. In javascript there are two types of scope.

1. local scope

2. global scope

JavaScript has function scope: Each function creates a new scope.

Scope determines the accessibility (visibility) of these variables. Variables defined inside a function are not accessible (visible) from outside the function.

 	var x = 10; 	
	function myFunction() {     	
		var name = "xyz"; 	
	} 

Here in example name has the local scope for this function. We can not access it outside of this function but x has global scope because we can access x inside the function and outside of it.

Local variables are created when a function starts, and deleted when the function is completed.

In JavaScript, objects and functions are also variables.

What is SEO

What is SEO

SEO is the part of digital marketing. SEO are two types one is on page SEO and another is off page SEO. …

read more
Security Checks in Node Js

Security Checks in Node Js

We can use lots of security check on node js for development and production environment. …

read more