aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/javascript/reference/global_objects/string/padstart/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-cn/web/javascript/reference/global_objects/string/padstart/index.html')
-rw-r--r--files/zh-cn/web/javascript/reference/global_objects/string/padstart/index.html8
1 files changed, 4 insertions, 4 deletions
diff --git a/files/zh-cn/web/javascript/reference/global_objects/string/padstart/index.html b/files/zh-cn/web/javascript/reference/global_objects/string/padstart/index.html
index 98d0f201ed..c358da2585 100644
--- a/files/zh-cn/web/javascript/reference/global_objects/string/padstart/index.html
+++ b/files/zh-cn/web/javascript/reference/global_objects/string/padstart/index.html
@@ -35,17 +35,17 @@ translation_of: Web/JavaScript/Reference/Global_Objects/String/padStart
<h2 id="示例">示例</h2>
-<pre class="brush: js line-numbers language-js"><code class="language-js">'abc'.padStart(10); // " abc"
+<pre class="brush: js line-numbers language-js">'abc'.padStart(10); // " abc"
'abc'.padStart(10, "foo"); // "foofoofabc"
'abc'.padStart(6,"123465"); // "123abc"
'abc'.padStart(8, "0"); // "00000abc"
-'abc'.padStart(1); // "abc"</code></pre>
+'abc'.padStart(1); // "abc"</pre>
<h2 id="Polyfill">Polyfill</h2>
<p>如果原生环境不支持该方法,在其他代码之前先运行下面的代码,将创建 <code>String.prototype.padStart()</code> 方法。</p>
-<pre class="brush: js line-numbers language-js"><code class="language-js">// https://github.com/uxitten/polyfill/blob/master/string.polyfill.js
+<pre class="brush: js line-numbers language-js">// https://github.com/uxitten/polyfill/blob/master/string.polyfill.js
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padStart
if (!String.prototype.padStart) {
String.prototype.padStart = function padStart(targetLength,padString) {
@@ -62,7 +62,7 @@ if (!String.prototype.padStart) {
return padString.slice(0,targetLength) + String(this);
}
};
-}</code>
+}
</pre>
<h2 id="规范">规范</h2>