JavaScript is required

Which of the following statements are correct about this function
Media VietJack

A.
The function calculates the value of 1 raised to power n
B.
The function calculates the factorial value of an integer
C.
The function calculates the square root of an integer
D.
None of above
Trả lời:

Đáp án đúng: B


Đoạn code trên tính giá trị của 1 lũy thừa n. Hàm `power` nhận một số nguyên `n` làm đầu vào. Nếu `n` bằng 0, hàm trả về 1. Ngược lại, hàm trả về 1 nhân với chính nó `n` lần. Do đó, đáp án đúng là A.

Câu hỏi liên quan