DIS in javascript, what is it?



  • I'm a junior, and so far I've had the experience of the PLO only in the Sific languages, and that's why I have a real question. What's theIS and javascript class?

    Is it right to define the class?

    function Coordinates() {
        this.x = 0.0;
        this.y = 0.0;
        function GetX() {return this.x;}
        function SetX(x) {this.x = x;}
        function GetY() {return this.y;}
        function SetY(y) {this.y = y;}
        return this;
    }
    

    And then use it like that.

    var test = Coordinates();
    test.SetX(1);
    test.GetX();
    

    Or is it wrong and I'm a fool and amateur? If it's wrong, how's that right?



  • In JS, as he is now no class, Prototypes♪ Well, the approach is that prototypes write like function♪ Like these prototypes, it's the case of every single prophet.

    Usually everyone knows the P.O.S., so they're P.O.'s head, and the tapes through functions and prototypes are like "syntaxis." But it doesn't have to be. The prototypes can be considered as the basis, they allow more than the PLO. But you'll be eaten with the guts by those who will read your code 🙂

    In the new JS standard, there's a normal class, like in the PLO and how everyone used to it. Inside, they're working through prototypes, but outward classes, methods, etc., not a prototype pot.

    If you don't like syntaxis, that's TypeScript and others, they're compiling in JS, they're normal classes and other cool things.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2