Getter and setter properties in JavaScript

Поділитися
Вставка
  • Опубліковано 5 вер 2024
  • In this lecture, you will learn, what is getter and setter properties are and how to use them in your JavaScript program. Getter and setter properties were introduced with the release of ECMAScript 5.

КОМЕНТАРІ • 16

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

    One of the most well explained videos that I have seen and I have seen a lot of videos. Really appreciate it. It is a shame that this channel's videos have gotten so much less views.

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

    Danke!

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

    Best tutorial about getter setter out of the several videos I watched. Thank you!

  • @Ansha-xq1uy
    @Ansha-xq1uy 11 місяців тому

    Watched the first few youtube recommendation for getter and setter which made me more chaotic ..THIS WAS CRYSTAL CLEAR .THANKS BROTHER . KEEP GOING

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

    Best lecture, After searching lot of lectures , I find this. Thank you 🙏

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

    You made it super easy to understand. Thanks for the video. God bless you

  • @MoneymakerGrowingFast
    @MoneymakerGrowingFast 11 місяців тому

    That's literaly the best video i've seem about getters and setters on javascript. Thanks man!

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

    you made it so easy to understand. Thank you for your hard work , sir.

  • @ndatech9549
    @ndatech9549 11 місяців тому

    this channel is a gold

  • @dicksoncyprian9511
    @dicksoncyprian9511 2 місяці тому

    PLEASE RELEASE TUTORIAL ON BACKEND LAMGUAGES LIKE JAVA/PYTHON/C++/PHP

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

    Thank you ❤

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

    Sir, I cannot have either get or set property alone. Although I only write get method for company , I can still set as User.company = 'abc' and company changed.

  • @slobodantajisic2762
    @slobodantajisic2762 7 місяців тому

    All properties in this tutorial are public, so we always have access to them. How to make properties in JavaScript private?

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

      JavaScript isn't a language like c, java or c++. The variables in JavaScript are determined private and public by the let and val keyword. let for private and val for public.

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

    Hi,
    I am new to programming, but as far as I know, in langauges like C#, you can make a property private, i.e., truly encapsulate it, hence making the use of getters and setter a NECESSITY, but here why would I NEED to use getters and setters when I can easily access and modify the properties? You said there are two reasons:
    1) Encapsulation
    2) When you modify/calculate a value.
    The second one makes sense, but you didn't give an example for the first one: how can you hide your data from the world when you can't make it private? Or maybe you can?
    Thanks,

    • @Saif.x
      @Saif.x Рік тому +3

      To hide the properties of the class or to make the properties of class private we use _ sign with properties.
      For example: constructor(name,password){
      this._name=name;
      this._password=password;
      }
      Now name and password properties are private and we can use get and set methods to perform operations on it indirectly