JavaScript | Math.cos()方法 (JavaScript | Math.cos() Method)

Math.cos() is a function in math library of JavaScript that is used to find the value of cosine of a number and return the value in radians.

Math.cos()是JavaScript数学库中的一个函数,用于查找数字的余弦值并返回以弧度为单位的值。

Syntax:

句法:

    Math.cos(x);

Parameter(s):

参数:

  • x – It represents the value whose cosine value to be found.

    x –表示要找到其余弦值的值。

Return value:

返回值:

The return type of this method is number, it returns the cosine value of the given x.

此方法的返回类型为number ,它返回给定x的余弦值。

Values accepted: Integer, floating-point, numeric string.

接受的值:整数,浮点数,数字字符串。

Invalid Values: non-numeric string, empty variable, empty array all will return NaN (Not a Number).

无效值:非数字字符串,空变量,空数组都将返回NaN(非数字)。

Browser support: Chrome, Internet asinlorer, Mozilla, Safari, Opera mini.

浏览器支持: Chrome,Internet代理,Mozilla,Safari,Opera mini。

Example 1: Valid values

示例1:有效值

console.log(Math.cos(-1));
console.log(Math.cos(0.1));
console.log(Math.cos(2));
console.log(Math.cos("0.65"));

Output

输出量

0.5403023058681398
0.9950041652780257
-0.4161468365471424
0.7960837985490559

Example 2: Invalid values

示例2:无效值

console.log(Math.cos("Javascript"));

Output

输出量

NaN

翻译自: https://www.includehelp.com/code-snippets/math-cos-method-with-example-in-javascript.aspx

JavaScript中带有示例的Math.cos()方法相关推荐

  1. JavaScript中带有示例的Math.log10()方法

    JavaScript | Math.log10()方法 (JavaScript | Math.log10() Method) Math operations in JavaScript are han ...

  2. JavaScript中带有示例的Math.abs()方法

    JavaScript | Math.abs()方法 (JavaScript | Math.abs() Method) Math operations in JavaScript are handled ...

  3. JavaScript中带有示例的Math.max()方法

    JavaScript | Math.max()方法 (JavaScript | Math.max() Method) Math.max() is a function in math library ...

  4. JavaScript中带有示例的Math.log()方法

    JavaScript | Math.log()方法 (JavaScript | Math.log() Method) Math.log() is a function in math library ...

  5. JavaScript中带有示例的Math.round()方法

    JavaScript | Math.round()方法 (JavaScript | Math.round() Method) Math.round() is a function in math li ...

  6. JavaScript中带有示例的Math.PI属性

    JavaScript | Math.PI属性 (JavaScript | Math.PI Property) Math.PI is a property in math library of Java ...

  7. math.sqrt 有问题_JavaScript中带有示例的Math.sqrt()方法

    math.sqrt 有问题 JavaScript | Math.sqrt()方法 (JavaScript | Math.sqrt() Method) The Math.sqrt() method is ...

  8. python教程cos_带有Python示例的math.cos()方法

    Python math.cos() 方法 math.cos()方法是数学模块的库方法,用于获取弧度数的余弦值,它接受一个数字,返回给定弧度的余弦值. 注意: math.cos()方法接受的唯一的号码, ...

  9. 1507四舍五入c语言,JavaScript中用于四舍五入的Math.round()方法讲解

    此方法返回一个数四舍五入为最接近的整数的值. 语法 Math.round( x ) ; 下面是参数的详细信息: x: 一个数字 返回值: 返回数字四舍五入为最接近的整数的值. 例子: JavaScri ...

最新文章

  1. 即将到来的金三银四,这10道springboot常见面试题你需要了解下
  2. 显示控制器注释_欧姆龙可编程控制器CS1D-CPU产品型号说明及功能介绍
  3. 美团点评技术年货:900+页电子书,覆盖前端、后台、大数据、算法……
  4. 【elasticsearch】Elasticsearch 7.X Scripting 脚本使用详解
  5. python二叉树遍历例子_python数据结构之二叉树的遍历实例
  6. 8盏流水灯反向闪烁c语言,课程设计(论文)_利用8255A芯片实现流水灯闪烁设计.doc...
  7. 《Java从小白到大牛精简版》之第6章 运算符(上)
  8. cad快速看图能合并图纸吗_【CAD快速看图电脑版】合并图纸、2张图之间复制
  9. Jquery提交表单(通过添加button的click事件)
  10. 计算机硬件单片机,计算机硬件单片机总结报告
  11. 合宙Luat | 嘿~合宙刚办了一场「大型网友见面会」
  12. 2-PHP代码审计——PHPCMSV9.6.0 sql注入漏洞
  13. 响应“交通强国”战略,百度地图重构行业生态价值
  14. 锐龙r7 5825u和r7 5800u的区别选哪个好
  15. 9.MVC模式 -- 改造源代码
  16. TI AWR1642学习笔记7 TSW1400采集原始数据
  17. 某zhan sign
  18. python高级应用_Python高级应用程序设计任务
  19. 华北地区博友链接集合(陆续增加中)
  20. Python3 识别图片验证码的步骤

热门文章

  1. css黑色字白色描边,css怎么设置字体白色描边
  2. redis核心技术与实战(二)缓存应用篇
  3. bash shell是如何识别特殊符号的
  4. Problem F: 结构体--学生信息排序
  5. 02-print的用法
  6. Kali Linux 2019.1 发布,Metasploit 更新到 5.0 版本
  7. 委托BegionInvoke和窗体BegionInvoke
  8. 关于概率算法的问题,不知道逻辑错在哪里,求debug
  9. lambda表达式之进化
  10. 运维经验分享(三)-- 解决Ubuntu下crontab不能正确执行脚本的问题