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

📄 number.html

📁 javascript 1.5规范
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<zrefheader>See also</zrefheader></B></FONT><BR><A NAME="1193377"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph><FONT FACE="courier, couriernew, monospaced size"><A HREF="toplev.html#1063963"  >Infinity</A></FONT>, <FONT FACE="courier, couriernew, monospaced size"><A HREF="toplev.html#1063988"  >isFinite</A></FONT></zparagraph></FONT><P><BR><P><A NAME="1193380"> </A><A NAME="POSITIVE_INFINITY"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="4"><B><zrefhead2>POSITIVE_INFINITY</zrefhead2></B></FONT><P><A NAME="1193381"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>A special numeric value representing infinity. This value is represented as the unquoted literal <FONT FACE="courier, couriernew, monospaced size">"Infinity"</FONT>.<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="1193384"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="-1"><ztabletext><I>Property of</I></ztabletext></FONT>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193389"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="-1"><ztabletext><A HREF="number.html#1193137"  >Number</A></ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP COLSPAN=2 ROWSPAN=1><P><A NAME="1193391"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="-1"><ztabletext><I>Static, Read-only</I></ztabletext></FONT></TD>  </TR>  <TR>    <TD VALIGN=TOP><P><A NAME="1193395"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="-1"><ztabletext><I>Implemented in</I></ztabletext></FONT>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193397"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="-1"><ztabletext>JavaScript 1.1, NES 2.0</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><P><A NAME="1194504"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="-1"><ztabletext><I>ECMA version</I></ztabletext></FONT>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1194506"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="-1"><ztabletext>ECMA-262</ztabletext></FONT>&nbsp;</TD>  </TR></TABLE><P></zparagraph></FONT><P><BR><A NAME="1193398"> </A><A NAME="Description"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="-1"><B><zrefheader>Description</zrefheader></B></FONT><BR><A NAME="1197681"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>This value behaves slightly differently than mathematical infinity:</zparagraph></FONT><P><ul><A NAME="1197682"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="-1"><B>  <li></B><zsmartlist1>Any positive value, including <FONT FACE="courier, couriernew, monospaced size">POSITIVE_INFINITY</FONT>, multiplied by <FONT FACE="courier, couriernew, monospaced size">POSITIVE_INFINITY</FONT> is <FONT FACE="courier, couriernew, monospaced size">POSITIVE_INFINITY</FONT>.</zsmartlist1></FONT><P><A NAME="1197683"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="-1"><B>  <li></B><zsmartlist1>Any negative value, including <FONT FACE="courier, couriernew, monospaced size">NEGATIVE_INFINITY</FONT>, multiplied by <FONT FACE="courier, couriernew, monospaced size">POSITIVE_INFINITY</FONT> is <FONT FACE="courier, couriernew, monospaced size">NEGATIVE_INFINITY</FONT>.</zsmartlist1></FONT><P><A NAME="1197684"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="-1"><B>  <li></B><zsmartlist1>Zero multiplied by <FONT FACE="courier, couriernew, monospaced size">POSITIVE_INFINITY</FONT> is <FONT FACE="courier, couriernew, monospaced size">NaN</FONT>.</zsmartlist1></FONT><P><A NAME="1197685"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="-1"><B>  <li></B><zsmartlist1><FONT FACE="courier, couriernew, monospaced size">NaN</FONT> multiplied by <FONT FACE="courier, couriernew, monospaced size">POSITIVE_INFINITY</FONT> is <FONT FACE="courier, couriernew, monospaced size">NaN</FONT>.</zsmartlist1></FONT><P><A NAME="1197686"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="-1"><B>  <li></B><zsmartlist1><FONT FACE="courier, couriernew, monospaced size">POSITIVE_INFINITY</FONT>, divided by any negative value except <FONT FACE="courier, couriernew, monospaced size">NEGATIVE_INFINITY</FONT>, is <FONT FACE="courier, couriernew, monospaced size">NEGATIVE_INFINITY</FONT>.</zsmartlist1></FONT><P><A NAME="1197687"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="-1"><B>  <li></B><zsmartlist1><FONT FACE="courier, couriernew, monospaced size">POSITIVE_INFINITY</FONT>, divided by any positive value except <FONT FACE="courier, couriernew, monospaced size">POSITIVE_INFINITY</FONT>, is <FONT FACE="courier, couriernew, monospaced size">POSITIVE_INFINITY</FONT>.</zsmartlist1></FONT><P><A NAME="1197688"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="-1"><B>  <li></B><zsmartlist1><FONT FACE="courier, couriernew, monospaced size">POSITIVE_INFINITY</FONT>, divided by either <FONT FACE="courier, couriernew, monospaced size">NEGATIVE_INFINITY</FONT> or <FONT FACE="courier, couriernew, monospaced size">POSITIVE_INFINITY</FONT>, is <FONT FACE="courier, couriernew, monospaced size">NaN</FONT>.</zsmartlist1></FONT><P><A NAME="1197689"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="-1"><B>  <li></B><zsmartlist1>Any number divided by <FONT FACE="courier, couriernew, monospaced size">POSITIVE_INFINITY</FONT> is Zero.</zsmartlist1></FONT><P></ul><A NAME="1193401"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>Because <FONT FACE="courier, couriernew, monospaced size">POSITIVE_INFINITY</FONT> is a static property of <FONT FACE="courier, couriernew, monospaced size">Number</FONT>, you always use it as <FONT FACE="courier, couriernew, monospaced size">Number.POSITIVE_INFINITY</FONT>, rather than as a property of a <FONT FACE="courier, couriernew, monospaced size">Number</FONT> object you created.</zparagraph></FONT><P><BR><A NAME="1193402"> </A><A NAME="Examples"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="-1"><B><zrefheader>Examples</zrefheader></B></FONT><BR><A NAME="1193403"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>In the following example, the variable <FONT FACE="courier, couriernew, monospaced size">bigNumber</FONT> is assigned a value that is larger than the maximum value. When the <FONT FACE="courier, couriernew, monospaced size">if</FONT> statement executes, <FONT FACE="courier, couriernew, monospaced size">bigNumber</FONT> has the value <FONT FACE="courier, couriernew, monospaced size">"Infinity"</FONT>, so the <FONT FACE="courier, couriernew, monospaced size">func1</FONT> function is called.</zparagraph></FONT><P><A NAME="1206640"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="-1"><zcodeline>var bigNumber = Number.MAX_VALUE * 10<br>if (bigNumber == Number.POSITIVE_INFINITY)<br>&nbsp;&nbsp;&nbsp;func1()<br>else<br>&nbsp;&nbsp;&nbsp;func2()</zcodeline></FONT><P><BR><A NAME="1193405"> </A><A NAME="See also"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="-1"><B><zrefheader>See also</zrefheader></B></FONT><BR><A NAME="1193412"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph><FONT FACE="courier, couriernew, monospaced size"><A HREF="toplev.html#1063963"  >Infinity</A></FONT>, <FONT FACE="courier, couriernew, monospaced size"><A HREF="toplev.html#1063988"  >isFinite</A></FONT></zparagraph></FONT><P><BR><P><A NAME="1193415"> </A><A NAME="prototype"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="4"><B><zrefhead2>prototype</zrefhead2></B></FONT><P><A NAME="1193416"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>Represents the prototype for this class. You can use the prototype to add properties or methods to all instances of a class. For information on prototypes, see <A HREF="function.html#1193426"  >Function.prototype</A>.<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="1193422"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="-1"><ztabletext><I>Property of</I></ztabletext></FONT>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193427"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="-1"><ztabletext><A HREF="number.html#1193137"  >Number</A></ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><P><A NAME="1193429"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="-1"><ztabletext><I>Implemented in</I></ztabletext></FONT>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193431"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="-1"><ztabletext>JavaScript 1.1, NES 2.0</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><P><A NAME="1194509"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="-1"><ztabletext><I>ECMA version</I></ztabletext></FONT>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1194511"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="-1"><ztabletext>ECMA-262</ztabletext></FONT>&nbsp;</TD>  </TR></TABLE><P></zparagraph></FONT><P><BR><P><A NAME="1200968"> </A><A NAME="toExponential"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="4"><B><zrefhead2>toExponential</zrefhead2></B></FONT><P><A NAME="1200985"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>Returns a string representing the Number object in exponential notation.<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="1200971"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="-1"><ztabletext><I>Method of</I></ztabletext></FONT>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1200976"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="-1"><ztabletext><A HREF="number.html#1193137"  >Number</A></ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><P><A NAME="1200978"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="-1"><ztabletext><I>Implemented in</I></ztabletext></FONT>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1200980"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="-1"><ztabletext>JavaScript 1.5</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><P><A NAME="1200982"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="-1"><ztabletext><I>ECMA version</I></ztabletext></FONT>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1200984"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="-1"><ztabletext>ECMA-262, Edition 3</ztabletext></FONT>&nbsp;</TD>  </TR></TABLE><P> </zparagraph></FONT><P><BR><A NAME="1201115"> </A><A NAME="Syntax"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="-1"><B><zrefheader>Syntax</zrefheader></B></FONT><BR><A NAME="1201116"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="-1"><zcodeline>toExponential([<I>fractionDigits</I>])</zcodeline></FONT><P><BR><A NAME="1201117"> </A><A NAME="Parameters"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="-1"><B><zrefheader>Parameters</zrefheader></B></FONT><BR><A NAME="1200994"> </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="1200991"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="-1"><zcodeline>fractionDigits</zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1200993"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="-1"><ztabletext>An integer specifying the number of digits after the decimal point. Defaults to as many digits as necessary to specify the number.</ztabletext></FONT>&nbsp;</TD>  </TR></TABLE><P></zparagraph></FONT><P><BR><A NAME="1200995"> </A><A NAME="Description"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="-1"><B><zrefheader>Description</zrefheader></B></FONT><BR><A NAME="1200996"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>The <FONT FACE="courier, couriernew, monospaced size">Number.prototype.toExponential</FONT> method returns a string representing a Number object in exponential notation with one digit before the decimal point, rounded to <FONT FACE="courier, couriernew, monospaced size"><I>fractionDigits</I></font> digits after the decimal point. If the <FONT FACE="courier, couriernew, monospaced size"><I>fractionDigits</I></font> argument is omitted, the number of digits after the decimal point defaults to the number of digits necessary to represent the value uniquely.</zparagraph></FONT><P><A NAME="1206809"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>If you use the <FONT FACE="courier, couriernew, monospaced size">toExponential</FONT> method for a numeric literal and the numeric literal has no exponent and no decimal point, leave a space before the dot that precedes the method call to prevent the dot from being interpreted as a decimal point.</zparagraph></FONT><P><A NAME="1207377"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>If a number has more digits that requested by the <FONT FACE="courier, couriernew, monospaced size"><I>fractionDigits</I></font> parameter, the number is rounded to the nearest number represented by <FONT FACE="courier, couriernew, monospaced size"><I>fractionDigits </I></font>digits. See the discussion of rounding in the description of the <FONT FACE="courier, couriernew, monospaced size">toFixed</FONT> method on <A HREF="number.html#1207032"  >page&nbsp;129</A>, which also applies to <FONT FACE="courier, couriernew, monospaced size">toExponential</FONT>.</zparagraph></FONT><P>

⌨️ 快捷键说明

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