<html>
<body>
<script>
class Car {
constructor(name) {
this.brand = name;
}
present() {
return 'I have a ' + this.brand;
}
}
class Model extends Car {
constructor(name, mod) {
super(name);
this.model = mod;
}
show() {
return this.present() + ', it is a ' + this.model
}
}
mycar = new Model("Ford", "Mustang");
document.write(mycar.show());
</script>
</body>
<!-- Mirrored from www.w3schools.com/react/tryit.asp?filename=tryreact_es6_class_inherit by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Jan 2020 02:43:09 GMT -->
</html>