I do not believe this is correct. At least, the MDN does not mention any such syntax.
As for your example, let's work through it line by line.
class MyClass { // Class declaration, all good here
x = null; // I assume you're telling javascript that the variable x exists?
constructor() {
this.x = 1; // You do that here just fine.
}
write() {
console.log(this.x); // And here we use the variable, after the constructor ran
}
}
I don't see any value in declaring the member variables seperately. You create it in the constructor. That should be all you need