DD2480-G9 / metrics-graphics

A library optimized for concise and principled data graphics and layouts.
http://metricsgraphicsjs.org
Mozilla Public License 2.0
0 stars 0 forks source link

Requirement: use cleaner syntax of classes #11

Closed BK239 closed 6 years ago

BK239 commented 6 years ago

Use the new syntax for class definitions and constructors (keywords class and constructor). For instance, the code below

var Shape = function (id, x, y) {
    this.id = id;
    this.move(x, y);
};
Shape.prototype.move = function (x, y) {
    this.x = x;
    this.y = y;
};

should be replaced by the following:

class Shape {
    constructor (id, x, y) {
        this.id = id this.move(x, y)
    }
    move (x, y) {
        this.x = x
        this.y = y
    }
}

This syntax is clearer, making it easier to understand and search for.

RickardBjorklund commented 6 years ago

No longer needed since assignment 3 is done!