Exchanging data with ES6 classes and JSON
This hasn't changed with ES2015. You still simply define a custom toJSON
method:
toJSON() { return {x: this.x, y: this.y};}
This hasn't changed with ES2015. You still simply define a custom toJSON
method:
toJSON() { return {x: this.x, y: this.y};}