From 42f5b4fb63ff997cbab40af1162f49d6fcaa3c86 Mon Sep 17 00:00:00 2001 From: blue Date: Sun, 18 Nov 2018 21:14:06 +0300 Subject: [PATCH] es6 syntax learning --- painting/canvas.js | 1 - painting/rectangle.js | 2 -- painting/shape.js | 5 +---- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/painting/canvas.js b/painting/canvas.js index d120be6..8ca8089 100644 --- a/painting/canvas.js +++ b/painting/canvas.js @@ -1,7 +1,6 @@ import Color from "./color.js"; class Canvas { - element; constructor() { this.element = document.createElement("canvas"); this.element.width = 1000; diff --git a/painting/rectangle.js b/painting/rectangle.js index 53700c3..dbfe3e5 100644 --- a/painting/rectangle.js +++ b/painting/rectangle.js @@ -1,8 +1,6 @@ import Shape from "./shape.js"; class Rectangle extends Shape { - className = "Rectangle"; - constructor(x, y, color, width, height) { super(x, y, color); diff --git a/painting/shape.js b/painting/shape.js index d596e46..a4d4d24 100644 --- a/painting/shape.js +++ b/painting/shape.js @@ -1,16 +1,13 @@ import Color from "./color.js"; class Shape { - className = "Shape"; - color; - constructor(x, y, color) { this._x = x; this._y = y; this.color = color; } draw(context) { - throw new Error("A pure virtual method call of a shape " + this.className); + throw new Error("A pure virtual method call of a shape " + this.constructor.name); } static randomOptions() {