class Rect {
constructor(x, y, width, height) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
containsPoint(x, y) {
return (
x >= this.x &&
y >= this.y &&
x <= this.x + this.width &&
y <= this.y + this.height
);
}
}
creactRect=()=>{
let rect = new Rect(0,0,40,40)
console.log(rect.containsPoint(20,20))
}
Rect
最新推荐文章于 2023-09-07 09:00:19 发布