Closures are one of the most elegant features in JavaScript. As we know, in JavaScript, functions are nothing but objects and because of this, we can do pretty amazing things with functions in JavaScript, such as passing functions as arguments to other functions. By definition, Closures are functions returned from another function. But how closures actually work under the hood is pretty magical and impressive.

So, let’s see a simple example and try to understand it:

function outer(){
let count=0;
return function(){
return count;
const result=outer();
console.log(result()); //1
console.log(result()); //2

On our console, we see 1 and…

Hello everyone!! ….So let’s start with some background check,I was a girl with no interest in coding but you never know “what life has in store for you”.I got a job in an IT firm and had to do development and that’s when i first time heard the term ‘React-Native’.I was okay with learning something new but had no idea where to start with.After going through a lot of videos ,tutorials,blogs etc I started getting it and was now ready to start with my first react native code.But before you start writing your code,the first thing one has to do…

Sakshi Chaudhary

Engineer | Front-End Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store