mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-12-16 15:54:22 +08:00
语法高亮,滚动条美化,设置页面调整
This commit is contained in:
@@ -27,16 +27,16 @@
|
||||
<h2 id="示例">示例</h2>
|
||||
<h3 id="禁止表达式检查">禁止表达式检查</h3>
|
||||
<p>下面代码会抛出一个 <a href="Reference/Global_Objects/TypeError" title="TypeError(类型错误) 对象用来表示值的类型非预期类型时发生的错误。"><code>TypeError</code></a>:</p>
|
||||
<pre class="brush: js">"/bar/".startsWith(/bar/);
|
||||
<pre><code class="language-javascript">"/bar/".startsWith(/bar/);
|
||||
|
||||
// Throws TypeError, 因为 /bar/ 是一个正则表达式
|
||||
// 且 Symbol.match 没有修改。</pre>
|
||||
// 且 Symbol.match 没有修改。</code></pre>
|
||||
<p>但是,如果你将 <code>Symbol.match</code> 置为 <code>false,使用 match 属性的</code>表达式检查会认为该象不是正则表达式对象。<code>startsWith</code> 和 <code>endsWith</code> 方法将不会抛出 <code>TypeError</code>。</p>
|
||||
<pre class="brush: js">var re = /foo/;
|
||||
<pre><code class="language-javascript">var re = /foo/;
|
||||
re[Symbol.match] = false;
|
||||
"/foo/".startsWith(re); // true
|
||||
"/baz/".endsWith(re); // false
|
||||
</pre>
|
||||
</code></pre>
|
||||
<h2 id="规范">规范</h2>
|
||||
<table class="standard-table">
|
||||
<tbody>
|
||||
|
||||
Reference in New Issue
Block a user