Skip to content

Commit

Permalink
Deploying to gh-pages from @ 27f3292 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
tsejx committed Dec 20, 2023
1 parent 3d176e2 commit 499b21e
Show file tree
Hide file tree
Showing 536 changed files with 1,086 additions and 1,042 deletions.
2 changes: 1 addition & 1 deletion 404.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
<body>
<div id="root"></div>

<script src="/javascript-guidebook/umi.cdc8a755.js"></script>
<script src="/javascript-guidebook/umi.f66a02d0.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion _demos/:uuid/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
<body>
<div id="root"></div>

<script src="/javascript-guidebook/umi.cdc8a755.js"></script>
<script src="/javascript-guidebook/umi.f66a02d0.js"></script>
</body>
</html>
4 changes: 2 additions & 2 deletions basic-concept/data-types/data-types/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion basic-concept/data-types/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@
window.g_initialProps = {};
</script>

<script src="/javascript-guidebook/umi.cdc8a755.js"></script>
<script src="/javascript-guidebook/umi.f66a02d0.js"></script>
</body>
</html>
4 changes: 2 additions & 2 deletions basic-concept/data-types/type-check/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@
</span></div><div class="token-line"><span class="token plain"></span><span class="token class-name">Obejct</span><span class="token punctuation">.</span><span class="token property-access">prototype</span><span class="token punctuation">.</span><span class="token method function property-access">toString</span><span class="token punctuation">.</span><span class="token method function property-access">call</span><span class="token punctuation">(</span><span class="token string">&#x27;&#x27;</span><span class="token punctuation">)</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"></span><span class="token comment">/// &quot;[object String]&quot;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">
</span></div><div class="token-line"><span class="token plain"></span><span class="token class-name">Obejct</span><span class="token punctuation">.</span><span class="token property-access">prototype</span><span class="token punctuation">.</span><span class="token method function property-access">toString</span><span class="token punctuation">.</span><span class="token method function property-access">call</span><span class="token punctuation">(</span><span class="token number">123</span><span class="token punctuation">)</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"></span><span class="token comment">// &quot;[object Number]&quot;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">
</span></div><div class="token-line"><span class="token plain"></span><span class="token class-name">Obejct</span><span class="token punctuation">.</span><span class="token property-access">prototype</span><span class="token punctuation">.</span><span class="token method function property-access">toString</span><span class="token punctuation">.</span><span class="token method function property-access">call</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"></span><span class="token comment">// &quot;[object Array]&quot;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain">
</span></div><div class="token-line"><span class="token plain"></span><span class="token class-name">Obejct</span><span class="token punctuation">.</span><span class="token property-access">prototype</span><span class="token punctuation">.</span><span class="token method function property-access">toString</span><span class="token punctuation">.</span><span class="token method function property-access">call</span><span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"></span><span class="token comment">// &quot;[object Object]&quot;</span></div></pre></div><p>💡 使用 <code>Object.prototype.toString</code> 方法能精准地判断出值的数据类型。</p><p>⚠️ <strong>注意事项</strong></p><ul><li><strong>方法重写</strong><code>Object.prototype.toString</code> 属于 Object 的原型方法,而 Array 或 Function 等类型作为 Object 的实例,都重写了 <code>toString</code> 方法。因此,不同对象类型调用 <code>toString</code> 方法时,调用的是重写后的 <code>toString</code> 方法,而非 <code>Object</code> 上原型 <code>toString</code> 方法,所以采用 <code>xxx.toString()</code> 不能得到其对象类型,只能将 <code>xxx</code> 转换成字符串类型。</li></ul><h2 id="constructor"><a aria-hidden="true" tabindex="-1" href="/javascript-guidebook//basic-concept/data-types/type-check#constructor"><span class="icon icon-link"></span></a>constructor</h2><p>任何对象都有 <code>constructor</code> 属性,继承自原型对象,<code>constructor</code> 会指向构造这个对象的构造器或构造函数。</p><div class="__dumi-default-code-block"><pre class="prism-code language-js"><button class="__dumi-default-icon __dumi-default-code-block-copy-btn" data-status="ready"></button><div class="token-line"><span class="token class-name">Student</span><span class="token punctuation">.</span><span class="token property-access">prototype</span><span class="token punctuation">.</span><span class="token property-access">constructor</span><span class="token plain"> </span><span class="token operator">===</span><span class="token plain"> </span><span class="token maybe-class-name">Student</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"></span><span class="token comment">// true</span></div></pre></div><h2 id="数组检测"><a aria-hidden="true" tabindex="-1" href="/javascript-guidebook//basic-concept/data-types/type-check#数组检测"><span class="icon icon-link"></span></a>数组检测</h2><p>ECMAScript5 将 <code>Array.isArray()</code> 正式引入 JavaScript,该方法能准确检测一个变量是否为数组类型。</p><div class="__dumi-default-code-block"><pre class="prism-code language-js"><button class="__dumi-default-icon __dumi-default-code-block-copy-btn" data-status="ready"></button><div class="token-line"><span class="token known-class-name class-name">Array</span><span class="token punctuation">.</span><span class="token method function property-access">isArray</span><span class="token punctuation">(</span><span class="token plain">variable</span><span class="token punctuation">)</span><span class="token punctuation">;</span></div></pre></div></div><div class="__dumi-default-layout-footer-meta"><a target="_blank" rel="noopener noreferrer" href="https://github.com/tsejx/javascript-guidebook/edit/master/docs/basic-concept/data-types/type-check.md">Edit this doc on GitHub<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="__dumi-default-external-link-icon"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a><span data-updated-text="Last update: ">12/19/2023 17:02:45</span></div></div></div></div>
</span></div><div class="token-line"><span class="token plain"></span><span class="token class-name">Obejct</span><span class="token punctuation">.</span><span class="token property-access">prototype</span><span class="token punctuation">.</span><span class="token method function property-access">toString</span><span class="token punctuation">.</span><span class="token method function property-access">call</span><span class="token punctuation">(</span><span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"></span><span class="token comment">// &quot;[object Object]&quot;</span></div></pre></div><p>💡 使用 <code>Object.prototype.toString</code> 方法能精准地判断出值的数据类型。</p><p>⚠️ <strong>注意事项</strong></p><ul><li><strong>方法重写</strong><code>Object.prototype.toString</code> 属于 Object 的原型方法,而 Array 或 Function 等类型作为 Object 的实例,都重写了 <code>toString</code> 方法。因此,不同对象类型调用 <code>toString</code> 方法时,调用的是重写后的 <code>toString</code> 方法,而非 <code>Object</code> 上原型 <code>toString</code> 方法,所以采用 <code>xxx.toString()</code> 不能得到其对象类型,只能将 <code>xxx</code> 转换成字符串类型。</li></ul><h2 id="constructor"><a aria-hidden="true" tabindex="-1" href="/javascript-guidebook//basic-concept/data-types/type-check#constructor"><span class="icon icon-link"></span></a>constructor</h2><p>任何对象都有 <code>constructor</code> 属性,继承自原型对象,<code>constructor</code> 会指向构造这个对象的构造器或构造函数。</p><div class="__dumi-default-code-block"><pre class="prism-code language-js"><button class="__dumi-default-icon __dumi-default-code-block-copy-btn" data-status="ready"></button><div class="token-line"><span class="token class-name">Student</span><span class="token punctuation">.</span><span class="token property-access">prototype</span><span class="token punctuation">.</span><span class="token property-access">constructor</span><span class="token plain"> </span><span class="token operator">===</span><span class="token plain"> </span><span class="token maybe-class-name">Student</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"></span><span class="token comment">// true</span></div></pre></div><h2 id="数组检测"><a aria-hidden="true" tabindex="-1" href="/javascript-guidebook//basic-concept/data-types/type-check#数组检测"><span class="icon icon-link"></span></a>数组检测</h2><p>ECMAScript5 将 <code>Array.isArray()</code> 正式引入 JavaScript,该方法能准确检测一个变量是否为数组类型。</p><div class="__dumi-default-code-block"><pre class="prism-code language-js"><button class="__dumi-default-icon __dumi-default-code-block-copy-btn" data-status="ready"></button><div class="token-line"><span class="token known-class-name class-name">Array</span><span class="token punctuation">.</span><span class="token method function property-access">isArray</span><span class="token punctuation">(</span><span class="token plain">variable</span><span class="token punctuation">)</span><span class="token punctuation">;</span></div></pre></div></div><div class="__dumi-default-layout-footer-meta"><a target="_blank" rel="noopener noreferrer" href="https://github.com/tsejx/javascript-guidebook/edit/master/docs/basic-concept/data-types/type-check.md">Edit this doc on GitHub<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="__dumi-default-external-link-icon"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a><span data-updated-text="Last update: ">12/20/2023 16:42:10</span></div></div></div></div>
<script>
window.g_useSSR = true;
window.g_initialProps = {};
</script>

<script src="/javascript-guidebook/umi.cdc8a755.js"></script>
<script src="/javascript-guidebook/umi.f66a02d0.js"></script>
</body>
</html>
Loading

0 comments on commit 499b21e

Please sign in to comment.