My own super implementation (class sample)

by Arnaud Buchholz

CSS

.message {
  display: inline-block;
  width: 50%;
}

.ok {
   color: green;
}

.ko {
  color: red;
}

JavaScript

class A {

    constructor (value = "a") {
        this._a = true;
        this._value = value;
    }

    getValue () {
        return this._value;
    }

}

class B extends A {

    constructor () {
        super("b");
        this._b = true;
    }

    getValue () {
        return super.getValue().toUpperCase();
    }
}

function assert (condition, message) {
	var line = document.createElement("div");
  line.className = "assert";
  var messageNode = document.createElement("span");
  messageNode.className = "message";
  messageNode.appendChild(document.createTextNode(message));
  line.appendChild(messageNode);
  var conditionNode = document.createElement("span");
  conditionNode.className = condition ? "ok" : "ko";
  conditionNode.innerHTML = condition ? "✔" : "ko";
  line.appendChild(conditionNode);
  return document.body.appendChild(line);
}

assert("function" === typeof A, "A is a function");
assert("function" === typeof B, "B is a function");
assert("function" === typeof A.prototype.getValue, "A.prototype.getValue is a function");
var b = new B();
assert(3 === Object.keys(b).length, "b has only 3 own properties");
["_a", "_b", "_value"].forEach(name => assert(b.hasOwnProperty(name), `b has own property ${name}`));
assert(b instanceof A, "b is an instance of A");