ES6 - Math.sin(x) 函式



此函式返回 x 弧度的正弦值。

語法

Math.sin(x)      

引數

  • X1 − 表示一個數字

範例

console.log("---Math.sin()---") 
console.log("Math.sin(Math.PI/2): "+Math.sin(Math.PI/2)) 
console.log("Math.sin(Math.PI/4): "+Math.sin(Math.PI/4))           

輸出

---Math.sin()--- 
Math.sin(Math.PI/2): 1 
Math.sin(Math.PI/4): 0.7071067811865475       
廣告
© . All rights reserved.