+ 1
Generator of objects
How write a generator of objects? Functional: Objects must creating in random place on screen. They must have parameters(width, height, position etc.) from CSS. For what: I want write a game for me friend. He sick, so I want support him this way. He go crazy when I write program special for him. Thank you in advance!
1 Antwort
+ 2
class {
constructor(width, height, posX, posY) {
this.height = height;
this.width = width;
this.posX = posX;
this.posY = posY;
}
get Area(){
return this.height*this.width;
}
sampleMethod(){
return `Object is ${this.width} units wide!`
}
}
Other than that, I'd say just learn about *ES6 Classes*