Hãy cho biết kết quả đoạn code sau?
Hãy cho biết kết quả đoạn code sau?
const shape = {
radius: 10,
diameter() {
return this.radius * 2;
},
perimeter: () => 2 * Math.PI * this.radius,
};
shape.diameter();
shape.perimeter();
20 and 62.8318530717958620 and NaN20 and 63NaN and 63 Chú ý rằng giá trị diameter là một hàm thông thường, còn perimeter là một arrow function.
Đăng nhập để tham gia thảo luận cùng mọi người.
Chưa có bình luận nào
Hãy là người đầu tiên chia sẻ suy nghĩ của bạn.