mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-12-18 17:04:28 +08:00
语法高亮,滚动条美化,设置页面调整
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
</div>
|
||||
<p><code><strong>startsWith()</strong></code>方法用来判断当前字符串是否是以另外一个给定的子字符串“开头”的,根据判断结果返回 <code>true</code> 或 <code>false</code>。</p>
|
||||
<h2 id="Syntax" name="Syntax">语法</h2>
|
||||
<pre class="syntaxbox"><code class="brush:js;"><em>str</em>.startsWith(<em>searchString</em> [, <em>position</em>])</code>;</pre>
|
||||
<pre><code class="language-javascript"><code class="brush:js;"><em>str</em>.startsWith(<em>searchString</em> [, <em>position</em>])</code>;</code></pre>
|
||||
<h3 id="参数">参数</h3>
|
||||
<dl>
|
||||
<dt><code>searchString</code></dt>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dd>在 <code>str</code> 中搜索 <code><var>searchString</var></code> 的开始位置,默认值为 0,也就是真正的字符串开头处。</dd>
|
||||
</dl>
|
||||
<h2 id="Examples" name="Examples">示例</h2>
|
||||
<pre class="brush:js;">var str = "To be, or not to be, that is the question.";
|
||||
<pre><code class="language-js;">var str = "To be, or not to be, that is the question.";
|
||||
|
||||
alert(str.startsWith("To be")); // true
|
||||
alert(str.startsWith("not to be")); // false
|
||||
alert(str.startsWith("not to be", 10)); // true</pre>
|
||||
alert(str.startsWith("not to be", 10)); // true</code></pre>
|
||||
<h2 id="Polyfill">Polyfill</h2>
|
||||
<pre class="brush: js">/*! http://mths.be/startswith v0.2.0 by @mathias */
|
||||
<pre><code class="language-javascript">/*! http://mths.be/startswith v0.2.0 by @mathias */
|
||||
if (!String.prototype.startsWith) {
|
||||
(function() {
|
||||
'use strict'; // needed to support `apply`/`call` with `undefined`/`null`
|
||||
@@ -76,7 +76,7 @@ if (!String.prototype.startsWith) {
|
||||
String.prototype.startsWith = startsWith;
|
||||
}
|
||||
}());
|
||||
}</pre>
|
||||
}</code></pre>
|
||||
<h2 id="浏览器兼容性">浏览器兼容性</h2>
|
||||
<div><div class="blockIndicator warning"><strong><a class="external" href="https://github.com/mdn/browser-compat-data" rel="noopener">We're converting our compatibility data into a machine-readable JSON format</a></strong>.
|
||||
This compatibility table still uses the old format,
|
||||
|
||||
Reference in New Issue
Block a user