⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 math.html

📁 javascript 1.5规范
💻 HTML
📖 第 1 页 / 共 5 页
字号:
</zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193302"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Returns the natural logarithm (base E) of a number.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193307"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="math.html#1197362"  >max</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193309"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Returns the greater of two numbers.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193314"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="math.html#1197403"  >min</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193316"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Returns the lesser of two numbers.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193321"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="math.html#1197651"  >pow</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193323"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Returns <FONT FACE="courier, couriernew, monospaced size">base</FONT> to the <FONT FACE="courier, couriernew, monospaced size">exponent</FONT> power, that is, <FONT FACE="courier, couriernew, monospaced size">base</FONT><SUP>exponent</SUP>.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193328"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="math.html#1197697"  >random</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193330"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Returns a pseudo-random number between 0 and 1.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193335"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="math.html#1197725"  >round</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193337"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Returns the value of a number rounded to the nearest integer.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193342"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="math.html#1197769"  >sin</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193344"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Returns the sine of a number.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193349"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="math.html#1197825"  >sqrt</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193351"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Returns the square root of a number.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193356"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="math.html#1194346"  >tan</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193358"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Returns the tangent of a number.</ztabletext></FONT>&nbsp;</TD>  </TR></TABLE><P></zparagraph></FONT><P><A NAME="1205814"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>In addition, this object inherits the <A HREF="object.html#1193628"  >watch</A> and <A HREF="object.html#1193499"  >unwatch</A> methods from <A HREF="object.html#1193136"  >Object</A>.</zparagraph></FONT><P><BR><P><A NAME="1195395"> </A><A NAME="abs"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="4"><B><zrefhead2>abs</zrefhead2></B></FONT><P><A NAME="1195412"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>Returns the absolute value of a number.<BR><P><TABLE WIDTH="90%" BORDER="1" CELLPADDING="5" CELLSPACING="0">  <CAPTION></CAPTION><P><FONT FACE=""><B></B></FONT><BR><BR>  <TR>    <TD VALIGN=TOP><P><A NAME="1195398"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext><I>Method of</I></ztabletext></FONT>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1195403"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext><A HREF="math.html#1193138"  >Math</A></ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP COLSPAN=2 ROWSPAN=1><P><A NAME="1195405"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext><I>Static</I></ztabletext></FONT></TD>  </TR>  <TR>    <TD VALIGN=TOP><P><A NAME="1195409"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext><I>Implemented in</I></ztabletext></FONT>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1195411"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>JavaScript 1.0, NES 2.0</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><P><A NAME="1201648"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext><I>ECMA version</I></ztabletext></FONT>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1201650"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>ECMA-262</ztabletext></FONT>&nbsp;</TD>  </TR></TABLE><P></zparagraph></FONT><P><BR><A NAME="1195413"> </A><A NAME="Syntax"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><B><zrefheader>Syntax</zrefheader></B></FONT><BR><A NAME="1195414"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline>abs(<I>x</I>)</zcodeline></FONT><P><BR><A NAME="1195415"> </A><A NAME="Parameters"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><B><zrefheader>Parameters</zrefheader></B></FONT><BR><A NAME="1195421"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph><BR><P><TABLE WIDTH="90%" BORDER="1" CELLPADDING="5" CELLSPACING="0">  <CAPTION></CAPTION><P><FONT FACE=""><B></B></FONT><BR><BR>  <TR>    <TD VALIGN=TOP><A NAME="1195418"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline>x</zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1195420"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>A number</ztabletext></FONT>&nbsp;</TD>  </TR></TABLE><P></zparagraph></FONT><P><BR><A NAME="1195422"> </A><A NAME="Examples"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><B><zrefheader>Examples</zrefheader></B></FONT><BR><A NAME="1195423"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>The following function returns the absolute value of the variable <FONT FACE="courier, couriernew, monospaced size">x</FONT>:</zparagraph></FONT><P><A NAME="1195424"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline>function getAbs(x) {<br>&nbsp;&nbsp;&nbsp;return Math.abs(x)<br>}</zcodeline></FONT><P><BR><A NAME="1195425"> </A><A NAME="Description"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><B><zrefheader>Description</zrefheader></B></FONT><BR><A NAME="1195426"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>Because <FONT FACE="courier, couriernew, monospaced size">abs</FONT> is a static method of <FONT FACE="courier, couriernew, monospaced size">Math</FONT>, you always use it as <FONT FACE="courier, couriernew, monospaced size">Math.abs()</FONT>, rather than as a method of a <FONT FACE="courier, couriernew, monospaced size">Math</FONT> object you created.</zparagraph></FONT><P><BR><P><A NAME="1195429"> </A><A NAME="acos"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="4"><B><zrefhead2>acos</zrefhead2></B></FONT><P><A NAME="1195446"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>Returns the arccosine (in radians) of a number.<BR><P><TABLE WIDTH="90%" BORDER="1" CELLPADDING="5" CELLSPACING="0">  <CAPTION></CAPTION><P><FONT FACE=""><B></B></FONT><BR><BR>  <TR>    <TD VALIGN=TOP><P><A NAME="1195432"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext><I>Method of</I></ztabletext></FONT>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1195437"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext><A HREF="math.html#1193138"  >Math</A></ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP COLSPAN=2 ROWSPAN=1><P><A NAME="1195439"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext><I>Static</I></ztabletext></FONT></TD>  </TR>  <TR>    <TD VALIGN=TOP><P><A NAME="1195443"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext><I>Implemented in</I></ztabletext></FONT>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1195445"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>JavaScript 1.0, NES 2.0</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><P><A NAME="1201669"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext><I>ECMA version</I></ztabletext></FONT>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1201671"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>ECMA-262</ztabletext></FONT>&nbsp;</TD>  </TR></TABLE><P></zparagraph></FONT><P><BR><A NAME="1195447"> </A><A NAME="Syntax"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><B><zrefheader>Syntax</zrefheader></B></FONT><BR><A NAME="1195448"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline>acos(<I>x</I>)</zcodeline></FONT><P><BR><A NAME="1195449"> </A><A NAME="Parameters"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><B><zrefheader>Parameters</zrefheader></B></FONT><BR><A NAME="1195455"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph><BR><P><TABLE WIDTH="90%" BORDER="1" CELLPADDING="5" CELLSPACING="0">  <CAPTION></CAPTION><P><FONT FACE=""><B></B></FONT><BR><BR>  <TR>    <TD VALIGN=TOP><A NAME="1195452"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline>x</zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1195454"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>A number</ztabletext></FONT>&nbsp;</TD>  </TR></TABLE><P></zparagraph></FONT><P><BR><A NAME="1195456"> </A><A NAME="Description"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><B><zrefheader>Description</zrefheader></B></FONT><BR><A NAME="1195457"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>The <FONT FACE="courier, couriernew, monospaced size">acos</FONT> method returns a numeric value between 0 and pi radians. If the value of <FONT FACE="courier, couriernew, monospaced size">number</FONT> is outside this range, it returns <FONT FACE="courier, couriernew, monospaced size">NaN</FONT>.</zparagraph></FONT><P><A NAME="1195458"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>Because <FONT FACE="courier, couriernew, monospaced size">acos</FONT> is a static method of <FONT FACE="courier, couriernew, monospaced size">Math</FONT>, you always use it as <FONT FACE="courier, couriernew, monospaced size">Math.acos()</FONT>, rather than as a method of a <FONT FACE="courier, couriernew, monospaced size">Math</FONT> object you created.</zparagraph></FONT><P><BR><A NAME="1195459"> </A><A NAME="Examples"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><B><zrefheader>Examples</zrefheader></B></FONT><BR><A NAME="1195460"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>The following function returns the arccosine of the variable <FONT FACE="courier, couriernew, monospaced size">x</FONT>:</zparagraph></FONT><P><A NAME="1195461"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline>function getAcos(x) {<br>&nbsp;&nbsp;&nbsp;return Math.acos(x)<br>}</zcodeline></FONT><P><A NAME="1195462"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>If you pass -1 to <FONT FACE="courier, couriernew, monospaced size">getAcos</FONT>, it returns 3.141592653589793; if you pass 2, it returns <FONT FACE="courier, couriernew, monospaced size">NaN</FONT> because 2 is out of range.</zparagraph></FONT><P><BR><A NAME="1195463"> </A><A NAME="See also"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><B><zrefheader>See also</zrefheader></B></FONT>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -