aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/javascript/reference/global_objects/math/pi/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-cn/web/javascript/reference/global_objects/math/pi/index.html')
-rw-r--r--files/zh-cn/web/javascript/reference/global_objects/math/pi/index.html8
1 files changed, 4 insertions, 4 deletions
diff --git a/files/zh-cn/web/javascript/reference/global_objects/math/pi/index.html b/files/zh-cn/web/javascript/reference/global_objects/math/pi/index.html
index 77f373196e..69b5ab79d1 100644
--- a/files/zh-cn/web/javascript/reference/global_objects/math/pi/index.html
+++ b/files/zh-cn/web/javascript/reference/global_objects/math/pi/index.html
@@ -23,11 +23,11 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Math/PI
<p>下面的函数使用 Math.PI 计算给定半径的圆周长:</p>
-<pre class="brush:js language-js" style="padding: 1em 0px 1em 30px; font-size: 14px; white-space: normal; color: rgb(77, 78, 83);"><code class="language-js" style="direction: ltr; white-space: pre;"><span class="keyword token" style="color: rgb(0, 119, 170);">function</span> calculateCircumference <span class="punctuation token" style="color: rgb(153, 153, 153);">(</span>radius<span class="punctuation token" style="color: rgb(153, 153, 153);">)</span> <span class="punctuation token" style="color: rgb(153, 153, 153);">{</span>
- <span class="keyword token" style="color: rgb(0, 119, 170);">return</span> <span class="number token" style="color: rgb(153, 0, 85);">2</span> <span class="operator token" style="background: rgba(255, 255, 255, 0.498039); color: rgb(166, 127, 89);">*</span> Math<span class="punctuation token" style="color: rgb(153, 153, 153);">.</span>PI <span class="operator token" style="background: rgba(255, 255, 255, 0.498039); color: rgb(166, 127, 89);">*</span> radius<span class="punctuation token" style="color: rgb(153, 153, 153);">;</span>
-<span class="punctuation token" style="color: rgb(153, 153, 153);">}</span>
+<pre class="brush:js language-js" style="padding: 1em 0px 1em 30px; font-size: 14px; white-space: normal; color: rgb(77, 78, 83);"><code class="language-js" style="direction: ltr; white-space: pre;">function calculateCircumference (radius) {
+ return 2 * Math.PI * radius;
+}
-<span class="function token" style="color: rgb(221, 74, 104);">calculateCircumference<span class="punctuation token" style="color: rgb(153, 153, 153);">(</span></span><span class="number token" style="color: rgb(153, 0, 85);">1</span><span class="punctuation token" style="color: rgb(153, 153, 153);">)</span><span class="punctuation token" style="color: rgb(153, 153, 153);">;</span> <span class="comment token" style="color: rgb(112, 128, 144);"> // 6.283185307179586</span></code></pre>
+calculateCircumference(1); // 6.283185307179586</code></pre>
<h2 id="规范">规范</h2>