-3

I am thinking something like this:

class T {
    static var A;
    static setA(value) {
        this.A = value;
    }
    static getA(value) {
        return this.A;
    }
}

so that it is stored in the class and can be both accessed and updated externally

lowtex
  • 707
  • 4
  • 22
  • how about trying it by yourself ? – shole Nov 10 '16 at 01:53
  • It does not seem to work when I try it, but I am not sure what the syntax would be if it were possible, and have not been able to find anything definitive one way or the other. – lowtex Nov 10 '16 at 01:58
  • @WesEason [your answers are here](http://stackoverflow.com/questions/28445693/how-do-i-make-a-public-static-field-in-an-es6-class/28454250#28454250) – Jim Nov 10 '16 at 02:00
  • Maybe I don't quite understand, but it seems like that solution does not allow modification of the statically accessible data – lowtex Nov 10 '16 at 02:18

1 Answers1

2

You can just do

class T {}
T.A = 7;
Amadan
  • 191,408
  • 23
  • 240
  • 301