aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/javascript/reference/global_objects/parsefloat
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-cn/web/javascript/reference/global_objects/parsefloat')
-rw-r--r--files/zh-cn/web/javascript/reference/global_objects/parsefloat/index.html18
1 files changed, 9 insertions, 9 deletions
diff --git a/files/zh-cn/web/javascript/reference/global_objects/parsefloat/index.html b/files/zh-cn/web/javascript/reference/global_objects/parsefloat/index.html
index 6469340da8..21d4e0bfbd 100644
--- a/files/zh-cn/web/javascript/reference/global_objects/parsefloat/index.html
+++ b/files/zh-cn/web/javascript/reference/global_objects/parsefloat/index.html
@@ -55,13 +55,13 @@ translation_of: Web/JavaScript/Reference/Global_Objects/parseFloat
<p>下面的例子都返回<strong>3.14</strong></p>
-<pre class="brush: js line-numbers language-js"><code class="language-js"><span class="function token">parseFloat</span><span class="punctuation token">(</span><span class="number token">3.14</span><span class="punctuation token">)</span><span class="punctuation token">;</span>
-<span class="function token">parseFloat</span><span class="punctuation token">(</span><span class="string token">'3.14'</span><span class="punctuation token">)</span><span class="punctuation token">;</span>
-<span class="function token">parseFloat</span><span class="punctuation token">(</span><span class="string token">' 3.14 '</span><span class="punctuation token">)</span><span class="punctuation token">;</span>
-<span class="function token">parseFloat</span><span class="punctuation token">(</span><span class="string token">'314e-2'</span><span class="punctuation token">)</span><span class="punctuation token">;</span>
-<span class="function token">parseFloat</span><span class="punctuation token">(</span><span class="string token">'0.0314E+2'</span><span class="punctuation token">)</span><span class="punctuation token">;</span>
-<span class="function token">parseFloat</span><span class="punctuation token">(</span><span class="string token">'3.14some non-digit characters'</span><span class="punctuation token">)</span><span class="punctuation token">;</span>
-<span class="function token">parseFloat</span><span class="punctuation token">(</span><span class="punctuation token">{</span> <span class="function function-variable token">toString</span><span class="punctuation token">:</span> <span class="keyword token">function</span><span class="punctuation token">(</span><span class="punctuation token">)</span> <span class="punctuation token">{</span> <span class="keyword token">return</span> <span class="string token">"3.14"</span> <span class="punctuation token">}</span> <span class="punctuation token">}</span><span class="punctuation token">)</span><span class="punctuation token">;</span></code></pre>
+<pre class="brush: js line-numbers language-js"><code class="language-js">parseFloat(3.14);
+parseFloat('3.14');
+parseFloat(' 3.14 ');
+parseFloat('314e-2');
+parseFloat('0.0314E+2');
+parseFloat('3.14some non-digit characters');
+parseFloat({ toString: function() { return "3.14" } });</code></pre>
<h3 id="parseFloat返回NaN"><code>parseFloat</code>返回NaN</h3>
@@ -74,8 +74,8 @@ translation_of: Web/JavaScript/Reference/Global_Objects/parseFloat
<p>以下例子均返回 <code>900719925474099300</code>,当整数太大以至于不能被转换时将失去精度。</p>
-<pre class="brush: js line-numbers language-js"><code class="language-js"><span class="function token">parseFloat</span><span class="punctuation token">(</span><span class="number token">900719925474099267n</span><span class="punctuation token">)</span><span class="punctuation token">;</span>
-<span class="function token">parseFloat</span><span class="punctuation token">(</span><span class="string token">'900719925474099267n'</span><span class="punctuation token">)</span><span class="punctuation token">;</span></code></pre>
+<pre class="brush: js line-numbers language-js"><code class="language-js">parseFloat(900719925474099267n);
+parseFloat('900719925474099267n');</code></pre>
<h2 id="规范">规范</h2>