News for hackers. Stuff that matters.
Re:The Simplest React Stack – Part 1: Bootstrapping and Stat... by molly0 on Thursday August 31, 2017 @03:16AM (#15138711)
get completed () Is "get" som es6 thing?
Re:The Simplest React Stack – Part 1: Bootstrapping and Stat... by thenewestkid on Thursday August 31, 2017 @03:20AM (#15138719)
It is actually ES5: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

In a nutshell: it is used for computed properties, which compute their value on 'get' operations instead of storing them.

Re:The Simplest React Stack – Part 1: Bootstrapping and Stat... by RobertKerans on Thursday August 31, 2017 @08:37AM (#15139828)
No, just not commonly used; getters and setters aren't terribly useful in a language that allows such easy direct modification of objects (as opposed to say Java)
Re:The Simplest React Stack – Part 1: Bootstrapping and Stat... by Symen on Thursday August 31, 2017 @10:52AM (#15140705)
But transparent getters and setters can be used to emulate private or immutable properties:

    function Foo() {
      var _bar = 42;
      return {
        get bar() {
          return _bar;
        }
      } 
    }

    var foo = Foo();
    foo.bar
    /*
    42
    */
However the fact that you can transparently replace a simple property by a computed one (e.g. for backwards compatibility or to trigger side effects in observables) does make explicit, Java-style, getters and setters less useful.