javascript vererbung Klasse extends super constructor
class Rectangle {
constructor(height, width) {
this.name = 'Rectangle';
this.height = height;
this.width = width;
}
sayName() {
console.log('Hi, I am a ', this.name + '.');
}
get area() {
return this.height * this.width;
}
set area(value) {
this.height = this.width = Math.sqrt(value);
}
}
class Square extends Rectangle {
constructor(length) {
this.height; // ReferenceError, super needs to be called first!
// Here, it calls the parent class' constructor with lengths
// provided for the Polygon's width and height
super(length, length);
// Note: In derived classes, super() must be called before you
// can use 'this'. Leaving this out will cause a reference error.
this.name = 'Square';
}
}
Also in JavaScript:
- debug.xcconfig: unable to open file react native
- sample data schema for patient record json format
- javascript get elements in both arrays
- javascript check if file exists on server
- upload photos cypress
- remove underline from hyperlink react
- ndjson to json javascript
- random item from array javascript
- asp.net core 3.1 ajax partial view
- how to run mocha tests on asynchronous functions in script
- react fun tion
- testing a function in jest on click react
- angular for each
- alpine.js install
- remover o primeiro caracter de uma string javascript
- optional chaining
- how to edit message discord.js
- how to multiple loop in javascript using for
- javascript rpg tutorial
- three dots in js
- remove a user from a reaction discord.js
- jquery automatically click message alert
- js check if number has decimals
- react js installation