math.atan2_JavaScript中带有示例的Math.atan2()方法

news/2024/7/19 15:00:52 标签: javascript, java, python, js, ajax

math.atan2

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

Math.atan2() is a function in math library of JavaScript that is used to find the arctangent of the quotient of its arguments. The method will return the numeric value which is the angle of (x,y) point and x-axis.

Math.atan2()是JavaScript数学库中的函数,用于查找其参数商的反正切。 该方法将返回作为(x,y)点和x轴角度的数值。

Syntax:

句法:

    Math.atan2(y,x);

Parameter(s):

参数:

  • y,x – represent the y and x co-ordinates on the point.

    y,x –代表该点的yx坐标。

Return value:

返回值:

The return type of this method is number, it returns the arctangent of the quotient of its parameter.

该方法的返回类型为number ,它返回其参数的商的反正切值。

Technical Insights:

技术见解:

  • JavaScript version: ECMAScript 1

    JavaScript版本:ECMAScript 1

  • Browser support: Chrome, Internet Explorer, Mozilla, Safari, Opera mini

    浏览器支持:Chrome,Internet Explorer,Mozilla,Safari,Opera mini

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

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

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

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

Example 1: Valid values for the method

示例1:方法的有效值

console.log(Math.atan2(2, 5));
console.log(Math.atan2(10.98, 2.3));
console.log(Math.atan2(-3.32, -1.23));
console.log(Math.atan2(0, 0));
console.log(Math.atan2("7.18", -9.23));

Output

输出量

0.3805063771123649
1.364310108279956
-1.9256000757252791
0
2.4804744828642002

Example 2: Invalid values for the method.

示例2:方法的无效值。

console.log(Math.atan2("IncludeHelp"));
// Output: NaN

console.log(Math.atan2(1 + 5i));
// Output: Uncaught SyntaxError: Invalid or unexpected token


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

math.atan2


http://www.niftyadmin.cn/n/1255736.html

相关文章

vue移动端项目

用vue mint-ui jquery-weui写了一个移动端demo 技术栈 vue2.0 vue-router axios mint-ui jquery-weui webpack 页面截图 最后附上github地址 https://github.com/xue11hua/one_vue 欢迎star转载于:https://www.cnblogs.com/aSnow/p/9049739.html

linear-gradient()函数以及CSS中的示例

Introduction: 介绍: So far, we have learned so many functions but learning never gets enough, therefore as a good developer, we must learn as many functions as we can and know their behavior with the help of practical implementations. But why d…

linux过滤器命令_Linux过滤器命令能力问题和解答

linux过滤器命令This section contains Aptitude Questions and Answers on Linux Filter Commands. 本节包含有关Linux筛选器命令的 Aptitude问题和解答。 1) There are the following statements that are given below which of them are correct about piping in the Linux…

[UE4]AnimOffset偏移动画

在每个在偏移动画要用到的动画文件中设置中设置上图属性。 也可以选择多个动画文件: 转载于:https://www.cnblogs.com/timy/p/9050961.html

Java ObjectStreamClass getField()方法与示例

ObjectStreamClass类的getField()方法 (ObjectStreamClass Class getField() method) getField() method is available in java.io package. getField()方法在java.io包中可用。 getField() method is used to return the field of this ObjectStreamClass by the given field …

vue中的select框的值动态绑定

<--这两种写法效果一样--> 1&#xff1a; <select v-model"wxStatus"><option label"已添加">1</option><option label"未添加">2</option><option label"拒绝添加">3</option> <…

Java ObjectStreamClass forClass()方法与示例

ObjectStreamClass类的forClass()方法 (ObjectStreamClass Class forClass() method) forClass() method is available in java.io package. forClass()方法在java.io包中可用。 forClass() method is used to return the Class in the local virtual machine that this versio…

js获取18个月前和30天后的时间

获取18个月前的时间 var date new Date(); var dateDemo date.setMonth(date.getMonth()-18); var startDate new Date(dateDemo); 获取30天后的时间 var startTime new Date(); var startDate new Date(startTime); startDate.setDate(startDate.getDate() 30);转载于:ht…