mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-12-15 23:37:25 +08:00
语法高亮,滚动条美化,设置页面调整
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<div></div>
|
||||
<p><strong><code>includes()</code> </strong>方法用于判断一个字符串是否包含在另一个字符串中,根据情况返回 true 或 false。</p>
|
||||
<h2 id="Syntax" name="Syntax">语法</h2>
|
||||
<pre class="syntaxbox"><code><var>str</var>.includes(<var>searchString</var>[, <var>position</var>])</code></pre>
|
||||
<pre><code class="language-javascript"><code><var>str</var>.includes(<var>searchString</var>[, <var>position</var>])</code></code></pre>
|
||||
<h3 id="参数">参数</h3>
|
||||
<dl>
|
||||
<dt><code>searchString</code></dt>
|
||||
@@ -18,7 +18,7 @@
|
||||
<p>这个方法可以帮你判断一个字符串是否包含另外一个字符串。</p>
|
||||
<h3 id="区分大小写">区分大小写</h3>
|
||||
<p><code>includes()</code> 方法是区分大小写的。例如,下面的表达式会返回 <code>false</code> :</p>
|
||||
<pre><code>'Blue Whale'.includes('blue'); // returns false</code></pre>
|
||||
<pre><code>'Blue Whale'.includes('blue'); // returns false</code></code></pre>
|
||||
<h2 id="Examples" name="Examples">示例</h2>
|
||||
<h3 id="使用_includes()">使用 includes()</h3>
|
||||
<pre><code>var str = 'To be, or not to be, that is the question.';
|
||||
@@ -27,7 +27,7 @@ console.log(str.includes('To be')); // true
|
||||
console.log(str.includes('question')); // true
|
||||
console.log(str.includes('nonexistent')); // false
|
||||
console.log(str.includes('To be', 1)); // false
|
||||
console.log(str.includes('TO BE')); // false</code></pre>
|
||||
console.log(str.includes('TO BE')); // false</code></code></pre>
|
||||
<h2 id="填充">填充</h2>
|
||||
<p>这个方法已经被加入到 ECMAScript 6 标准中,但未必在所有的 JavaScript 实现中都可以使用。然而,你可以轻松地 polyfill 这个方法:</p>
|
||||
<pre><code>if (!String.prototype.includes) {
|
||||
@@ -43,7 +43,7 @@ console.log(str.includes('TO BE')); // false</code></pre>
|
||||
return this.indexOf(search, start) !== -1;
|
||||
}
|
||||
};
|
||||
}</code></pre>
|
||||
}</code></code></pre>
|
||||
<h2 id="规范">规范</h2>
|
||||
<table>
|
||||
<tbody>
|
||||
|
||||
Reference in New Issue
Block a user