Tuesday, September 1, 2020

Learn Closure in JavaScript-Day 5



In this article, we are going to understand the closure concept in javascript.


                                      
                   


Closures in JavaScript:

  •  The closure is inner function that has access to outer function.
  • In javascript, closures are created every time a function is created, at function creation time.
  • A closure is a function having access to the parent scope, even after the parent function has closed.


                                              

Scope:

                  A scope in javascript defines what variables you have access to.

there are three kinds of scope-
1.Global scope
2.Local scope
3.Outer Function scope.



The closure has three scopes which are as follows:



                                       


  • It has access to its own scope.                                                                                    
  •  It has access to its outer function variables.
  •  It has access to global variables.


Example:

Program:



output:










Thank you!!!!!!!!!!!!!

Function in SQL -part 8

  In this blog we are going to understand  Sql function.   FUNCTION: A function is a database object in SQL Server. It accepts only input pa...