static fromWidthHeight(w, h) { //return a rectangle with dimensions w by h let rec = new Rectangle(); rec.setWidth(w); rec.setHeight(h); return rec; }
static fromSide(side) { //return a square per the param return this.fromWidthHeight(side, side); }
let rec = Rectangle.fromWidthHeight(10, 5); let square = Rectangle.fromSide(100);