//In Javascript there are no generics
class Size {
constructor(width, height) {
this.width = width;
this.height = height;
}
asText() {
return `[${this.width}; ${this.height}]`;
}
}
let sizeInt = new Size(5, 8);
let textInt = sizeInt.asText();
//textInt is "[5; 8]"
let sizeFloat = new Size(3.7, 1.58);
let textFloat = sizeFloat.asText();
//textFloat is "[3.7; 1.58]"
console.log(`textInt is "${textInt}"`);
console.log(`textFloat is "${textFloat}"`);