Câu hỏi
Kết quả đoạn code sau là gì?
const shape = {
radius: 10,
diameter() {
return this.radius * 2;
},
perimeter: () => 2 * Math.PI * this.radius,
};
shape.diameter();
shape.perimeter();
- A:
20
and62.83185307179586
- B:
20
andNaN
- C:
20
and63
- D:
NaN
and63
Đáp án: B
Chú ý rằng giá trị diameter
là một hàm thông thường, còn perimeter
là...