Confused with Closures? Not anymore! | Closures in JS Explained in Depth | Hindi

Поділитися
Вставка
  • Опубліковано 18 гру 2024

КОМЕНТАРІ • 57

  • @procodrr
    @procodrr  Рік тому +4

    Note: You might not see [[Scopes]] in the console because in new version of Chrome they have removed it. If you want to see it then please us any older version of Chrome which was available before uploading this video that is September 2022.
    Chrome in August 2022: google-chrome.en.uptodown.com/windows/download/79849930

  • @sureshchoudhary7174
    @sureshchoudhary7174 5 місяців тому +1

    Explanation at its peak, Thanks a lot.
    There can be many use cases for closures, one of the simple use case that I came across is we can sort of mimic the Class methods and instance creation with this, like below.
    function account() {
    let bal = 0;
    function initilize(amount) {
    bal = amount
    }
    function credit(amount) {
    bal+=amount
    }
    function debit(amount) {
    bal-=amount
    }
    function showBalance() {
    console.log("Your current balance is", bal)
    }
    return {initilize, credit, debit, showBalance}
    }
    const a0 = account()
    a0.showBalance();
    // output - Your current balance is 0
    a0.initilize(50)
    a0.showBalance()
    // output - Your current balance is 50
    a0.credit(11);
    a0.showBalance();
    // output - Your current balance is 61
    a0.debit(9)
    a0.showBalance()
    // output - Your current balance is 52
    similarly we can create other accounts i.e. a1, a2 and each will have different memory.

  • @kirtiraghav7491
    @kirtiraghav7491 8 місяців тому +4

    JS course ke ep38 pe thi, udhar samajh nhi aaya issiliye ye video dekha. Finally closure samajh aagaya. thank you sir.

  • @mayankdeep4881
    @mayankdeep4881 8 місяців тому +7

    Sita Ram must have planned something great for me in this career that's why I discovered your channel sir. whatever is the topic I need to learn you have the detailed video of that. Hats off to you sir.

    • @procodrr
      @procodrr  8 місяців тому +1

      You'll definitely do well in your career. All the best 👍

    • @PRATHAMESHCHAVAN-pk2xn
      @PRATHAMESHCHAVAN-pk2xn 3 місяці тому

      This is the best comment i've seen to a coding creator

  • @nehagawali461
    @nehagawali461 6 місяців тому +3

    Finally, I understand the concept of closure. Thank you so much, sir

  • @gauthamchengappa1702
    @gauthamchengappa1702 2 роки тому +3

    Great Video Anurag! Till now I was only knowing the definition, now clearly understood what closure means and also about their disadvantages and advantages.
    Also please make videos on function currying and memoization.
    Thanks :)

  • @mohitsoni3819
    @mohitsoni3819 11 місяців тому +3

    Sir, Love You for your teaching way and your hard work ⭐, kaafi accha lag raha hai JS aapse padkr or bhut kuch sikne ko bhi mila, mai continuously aapke CSS or JS ki playlist ko follow kiya or abhi JS kar raha hu or maine kaafi kuch sika, OR Really maine Debugging pheli baar itni acche se sikhi hai JS mai 🚀💯,
    ThankYou So Much Sir

    • @procodrr
      @procodrr  11 місяців тому +1

      Ye to bahot achhi baat hai ki tumhara padhai mein lag raha hai.
      Aise ki padhai karte raho aur seekhte raho, koi bhi doubt aaye to yaha comments mein bhi poochh sakte ho aur telegram group mein bhi.
      Keep learning and sharing 😊

  • @deepend101
    @deepend101 10 місяців тому +1

    1 din poora laga closures ko acche se samajhne me baaaki samajh aa gaya aur kabhi na bhulu esa samajh aaya, par time laga and thank you bhaiya...😊😊

    • @procodrr
      @procodrr  10 місяців тому

      Awesome, achhe se samjhne mein time to lagta hai. Agar aur bhi janna hai closures ke bare mein to ye wali video bhi dekh sakte ho.
      ua-cam.com/video/w_-fVsa6qns/v-deo.html

  • @faizsings
    @faizsings 3 місяці тому

    Sir aap bahot mehnat karte hai, ham sabke liye, is video ko dekhne ke bad realize hua

  • @vedangnikure
    @vedangnikure 6 місяців тому +1

    your way of explanation is so amazing👌👌👌👌

  • @mohammadumair4638
    @mohammadumair4638 2 роки тому +4

    nicely explained

  • @learncode5110
    @learncode5110 2 роки тому +3

    So grateful for explored this channel very well explained everything... just wanted to ask have you uploaded fundamental of Javascript or only advance JS playlist?

    • @procodrr
      @procodrr  2 роки тому +1

      Thank you so much Bro 😊.
      Fundamentals of JavaScript I will start from 1st of November.

    • @learncode5110
      @learncode5110 2 роки тому +1

      @@procodrr That's super cool bro waiting for it. Best luck 🤩😇

    • @procodrr
      @procodrr  2 роки тому

      Awesome bro 😊

    • @learncode5110
      @learncode5110 2 роки тому +1

      @@procodrr ☺😇

    • @learncode5110
      @learncode5110 2 роки тому +1

      @@procodrr Just one more question to ask in future are you coving full stack(MERN) Bootcamp?

  • @KrishnaKamlesh-r6z
    @KrishnaKamlesh-r6z 8 місяців тому +2

    Lots of love bro❤

  • @Abhisheksoft
    @Abhisheksoft Рік тому +2

    32:00 Both are same closers and lexical scope

    • @procodrr
      @procodrr  Рік тому +1

      Yes, they are kind of same in one way. But when lexical scope gets attached to a function then we call it a Closure.

    • @Abhisheksoft
      @Abhisheksoft Рік тому

      @@procodrr yes sir parent function k variable ko access krenge child function then create a closures and lexical

  • @ishanSINGH1999
    @ishanSINGH1999 5 місяців тому

    thank you for your brilliant content sir. highly appreciate it!!

  • @aadilyt1573
    @aadilyt1573 6 місяців тому +1

    Wowww That's gazab 😍

  • @arizkhan218
    @arizkhan218 Місяць тому

    Sir you're best thank uhh ❤🥀

  • @sakshampethkar01
    @sakshampethkar01 2 роки тому +6

    Make a tutorial on how to use dev tools and debugger

    • @procodrr
      @procodrr  2 роки тому +3

      Sure, I will make a video on it.

    • @procodrr
      @procodrr  2 роки тому +2

      Hi Bro, I have just uploaded that debugging video.
      You can check it out.

    • @sakshampethkar01
      @sakshampethkar01 2 роки тому +1

      @@procodrr sure bro

  • @aadilyt1573
    @aadilyt1573 6 місяців тому +1

    You're really amazing

    • @procodrr
      @procodrr  6 місяців тому

      Thank you so much 😀

  • @prashant6804
    @prashant6804 Місяць тому

    Awesome!!!!❤ it

  • @AnkitSingh-uf1sx
    @AnkitSingh-uf1sx 7 місяців тому +2

    bhaiya leet code 30 day challenges ki video bana do sir m

  • @shrikantlandage7305
    @shrikantlandage7305 7 місяців тому +2

    kadak bhai

  • @faizelahi4147
    @faizelahi4147 2 роки тому +4

    Please make a tutorial on ruby

  • @zuhairrehman2526
    @zuhairrehman2526 6 місяців тому +3

    Bas khatam! Interviewer ka Closure set hai! Aage zindagi mein kab use karna hai isko, ye Closure hi jaane.....

  • @ayushnigam9424
    @ayushnigam9424 5 місяців тому

    Thank you so muchhh!!!

  • @JITESHPANDEY-qm1og
    @JITESHPANDEY-qm1og 3 місяці тому

    Great sir

  • @Kevinmattmurdock
    @Kevinmattmurdock 2 роки тому +6

    Please make a tutorial on python

    • @sakshampethkar01
      @sakshampethkar01 2 роки тому +1

      Let him finish JS first?

    • @procodrr
      @procodrr  2 роки тому +1

      Yes, Right now I am focusing only on JavaScript.

    • @procodrr
      @procodrr  2 роки тому +1

      Not now bro. Web development and JavaScript are my expertise. So if you ask me anything related to that I will definitely make it.
      Talking about Python, I don't have much experience with that. So, I won't be making course on it any soon.

  • @sudhansusekhar7722
    @sudhansusekhar7722 10 місяців тому +1

    Is execution contest and closure are same ???

    • @alizarweto8437
      @alizarweto8437 8 місяців тому +1

      There is no thought of compression... execution context...is all about. How the program
      will be executed as per javascript engine, and closure define the scope of execution or extent of availablity of variable (state) for a function

  • @yogeshpatel836
    @yogeshpatel836 Місяць тому

    Sir my lower middle class family se belong karata hu my 4-5 year se dhekedari me pardesh rahakar Kam kar Raha hu my one month se aap ka video starting se dekh Raha hu
    Mere pass sir laptop nhi hai my second hand laptop kharidane ja Raha hu coding sikhane ke liye
    Sir coding sikhane ke liye kaun sa laptop kharidu my .
    Sir please bataiye my life me kuch karana chahata hu my apane family ka status chenge karana chatata hu kuch acha Kam kar ke
    Please sir help kariye

  • @Dk-ox5bz
    @Dk-ox5bz 2 місяці тому

    sir promises ka bhi end game lekr aao

  • @prabinnnnn
    @prabinnnnn 4 місяці тому

    51:55

  • @GauthamHC99
    @GauthamHC99 2 роки тому +5

    Great Video Anurag! Till now I was only knowing the definition, now clearly understood what closure means and also about their disadvantages and advantages.
    Also please make videos on function currying and memoization.
    Thanks :)

    • @procodrr
      @procodrr  2 роки тому +1

      Thanks bro. I'll make that video for sure.