Getters and Setters in JavaScript

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

КОМЕНТАРІ • 21

  • @papunmohanty5968
    @papunmohanty5968 4 роки тому

    Crystal clear explanation 👌

  • @Videosuser
    @Videosuser 4 роки тому +1

    Good examples. I really like that you don't simply explain how to do the code, but also explains WHY we should write the code this way. Keep up the good work.

  • @joeyng1282
    @joeyng1282 4 роки тому

    Thanks Mr. Chinnathambi

  • @abhipatil5111
    @abhipatil5111 4 роки тому

    Great video , cleared all the doubts regarding the getter and setter and how useful they're.

  • @arunkaiser
    @arunkaiser 4 роки тому +1

    Awesome Kirupa ❤️

    • @kirupa
      @kirupa  4 роки тому +1

      Glad you liked it :-)

    • @arunkaiser
      @arunkaiser 4 роки тому

      @@kirupa I always do it

  • @cworks73
    @cworks73 3 роки тому +1

    Thanks Kirupa

  • @manojbharadwaj456
    @manojbharadwaj456 4 роки тому +1

    Found an awesome channel. Great work man!

  • @rblakewatson
    @rblakewatson 4 роки тому +1

    Love your videos. This one was exactly what I needed!

    • @kirupa
      @kirupa  4 роки тому

      Awesome! Thank you, Blake! :P

  • @loveparmar1284
    @loveparmar1284 4 роки тому +1

    ahaa.. great video sir .. Liked it .

  • @mitch1668
    @mitch1668 4 роки тому

    This was amazing, thank you! Subscribed!

  • @BahawalTV
    @BahawalTV 4 роки тому

    Good explanation. Can we use getters and setters without a backing property?

    • @kirupa
      @kirupa  4 роки тому +1

      Absolutely! You would just ignore the value that gets passed in and have something that behaves like a function while being used like a property :-)

  • @your_utube
    @your_utube 4 роки тому +1

    Thanks!

    • @kirupa
      @kirupa  4 роки тому

      You bet! :P

  • @MichaelSalo
    @MichaelSalo 4 роки тому

    I never understand why magic getters and setters are necessary. I get that a function is more useful than a property. So write a regular method. getMessage()

    • @kirupa
      @kirupa  4 роки тому +1

      Getters and Setters are just shortcuts to a getMessage and setMessage function. The biggest benefit they provide is in validation and other related "behind the scenes" processing that you don't want to bore a regular user of an object property with :P

    • @your_utube
      @your_utube 4 роки тому

      @@kirupa I agree, and also just for abstraction in general and information hiding

  • @AnaninkiSan
    @AnaninkiSan 4 роки тому

    thx!