Warning: count(): Parameter must be an array or an object that implements Countable in /home/niteshcpanel2/public_html/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/fs/package.module.fs.php on line 258

Warning: count(): Parameter must be an array or an object that implements Countable in /home/niteshcpanel2/public_html/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/fs/package.module.fs.php on line 258

Warning: count(): Parameter must be an array or an object that implements Countable in /home/niteshcpanel2/public_html/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/fs/package.module.fs.php on line 258

Warning: count(): Parameter must be an array or an object that implements Countable in /home/niteshcpanel2/public_html/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/fs/package.module.fs.php on line 258

Warning: count(): Parameter must be an array or an object that implements Countable in /home/niteshcpanel2/public_html/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/fs/package.module.fs.php on line 258

Warning: count(): Parameter must be an array or an object that implements Countable in /home/niteshcpanel2/public_html/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/fs/package.module.fs.php on line 258

Warning: count(): Parameter must be an array or an object that implements Countable in /home/niteshcpanel2/public_html/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/fs/package.module.fs.php on line 258

Warning: count(): Parameter must be an array or an object that implements Countable in /home/niteshcpanel2/public_html/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/fs/package.module.fs.php on line 258

Warning: count(): Parameter must be an array or an object that implements Countable in /home/niteshcpanel2/public_html/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/fs/package.module.fs.php on line 258

Warning: count(): Parameter must be an array or an object that implements Countable in /home/niteshcpanel2/public_html/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/fs/package.module.fs.php on line 258

Warning: count(): Parameter must be an array or an object that implements Countable in /home/niteshcpanel2/public_html/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/fs/package.module.fs.php on line 258

Warning: count(): Parameter must be an array or an object that implements Countable in /home/niteshcpanel2/public_html/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/fs/package.module.fs.php on line 258

Warning: count(): Parameter must be an array or an object that implements Countable in /home/niteshcpanel2/public_html/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/fs/package.module.fs.php on line 258

Warning: count(): Parameter must be an array or an object that implements Countable in /home/niteshcpanel2/public_html/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/fs/package.module.fs.php on line 258

Warning: count(): Parameter must be an array or an object that implements Countable in /home/niteshcpanel2/public_html/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/fs/package.module.fs.php on line 258

Warning: preg_match(): Compilation failed: invalid range in character class at offset 31 in /home/niteshcpanel2/public_html/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/router/package.module.router.php on line 465

Warning: preg_match(): Compilation failed: invalid range in character class at offset 30 in /home/niteshcpanel2/public_html/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/router/package.module.router.php on line 465
JavaScript Closure | Nitesh Thapa

JavaScript Closure

In closure inner function can access the variable and parameters of its outer function even after the outer function has returned.In this example inner function can access the retirement function parameter and (A) variable which is outsite for inner function this is closure.

function retirment(retirmentAge){
	 var a = ' years left until retirement';
		return function(yearOfBirth){
			var age = 2016 - yearOfBirth;
			console.log(((retirmentAge - age) + a))
		}
	 }
	var retirmentUS = retirment(66);
		retirmentUS(1990);
retirment(66)(1991);

Notice: compact(): Undefined variable: limits in /home/niteshcpanel2/public_html/wp-includes/class-wp-comment-query.php on line 821

Notice: compact(): Undefined variable: groupby in /home/niteshcpanel2/public_html/wp-includes/class-wp-comment-query.php on line 821

Warning: count(): Parameter must be an array or an object that implements Countable in /home/niteshcpanel2/public_html/wp-includes/class-wp-comment-query.php on line 399

Leave a Reply

Your email address will not be published. Required fields are marked *