Skip to content

Commit

Permalink
Deploying to gh-pages from @ a3a75b7 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
tsejx committed Mar 27, 2022
1 parent 1d608b0 commit a5a5cca
Show file tree
Hide file tree
Showing 525 changed files with 1,947 additions and 1,733 deletions.
4 changes: 2 additions & 2 deletions 404.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
window.routerBase = "/javascript-guidebook/";
</script>
<script>
//! umi version: 3.5.20
//! umi version: 3.5.21
</script>
<script>
!(function () {
Expand All @@ -30,6 +30,6 @@
<body>
<div id="root"></div>

<script src="/javascript-guidebook/umi.6cde7df5.js"></script>
<script src="/javascript-guidebook/umi.b0c512ca.js"></script>
</body>
</html>
4 changes: 2 additions & 2 deletions _demos/:uuid/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
window.routerBase = "/javascript-guidebook/";
</script>
<script>
//! umi version: 3.5.20
//! umi version: 3.5.21
</script>
<script>
!(function () {
Expand All @@ -30,6 +30,6 @@
<body>
<div id="root"></div>

<script src="/javascript-guidebook/umi.6cde7df5.js"></script>
<script src="/javascript-guidebook/umi.b0c512ca.js"></script>
</body>
</html>
6 changes: 3 additions & 3 deletions basic-concept/data-types/data-types/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions basic-concept/data-types/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
window.routerBase = "/javascript-guidebook/";
</script>
<script>
//! umi version: 3.5.20
//! umi version: 3.5.21
</script>
<script>
!(function () {
Expand All @@ -34,6 +34,6 @@
window.g_initialProps = {};
</script>

<script src="/javascript-guidebook/umi.6cde7df5.js"></script>
<script src="/javascript-guidebook/umi.b0c512ca.js"></script>
</body>
</html>
8 changes: 4 additions & 4 deletions basic-concept/data-types/type-check/index.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions basic-concept/data-types/type-conversion/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
window.routerBase = "/javascript-guidebook/";
</script>
<script>
//! umi version: 3.5.20
//! umi version: 3.5.21
</script>
<script>
!(function () {
Expand Down Expand Up @@ -90,12 +90,12 @@
</span></div><div class="token-line"><span class="token plain"></span><span class="token keyword">const</span><span class="token plain"> eq </span><span class="token operator">=</span><span class="token plain"> a </span><span class="token operator">==</span><span class="token plain"> </span><span class="token number">1</span><span class="token plain"> </span><span class="token operator">&amp;&amp;</span><span class="token plain"> a </span><span class="token operator">==</span><span class="token plain"> </span><span class="token number">2</span><span class="token plain"> </span><span class="token operator">&amp;&amp;</span><span class="token plain"> a </span><span class="token operator">==</span><span class="token plain"> </span><span class="token number">3</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation">.</span><span class="token method function property-access">log</span><span class="token punctuation">(</span><span class="token plain">eq</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">// true</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 comment">// 或者改写他的 toString 方法</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"></span><span class="token keyword">const</span><span class="token plain"> num </span><span class="token operator">=</span><span class="token plain"> </span><span class="token number">0</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"></span><span class="token class-name">Function</span><span class="token punctuation">.</span><span class="token property-access">prototype</span><span class="token punctuation">.</span><span class="token method-variable function-variable method function property-access">toString</span><span class="token plain"> </span><span class="token operator">=</span><span class="token plain"> </span><span class="token keyword">function</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"> </span><span class="token keyword control-flow">return</span><span class="token plain"> </span><span class="token operator">++</span><span class="token plain">num</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"></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 keyword">function</span><span class="token plain"> </span><span class="token function">a</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token plain"> </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></div><div class="token-line"><span class="token plain"></span><span class="token comment">// 还可以改写 ES6 的 Symbol 类型的 toPrimitive 的方法</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"></span><span class="token keyword">const</span><span class="token plain"> a </span><span class="token operator">=</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"> </span><span class="token punctuation">[</span><span class="token known-class-name class-name">Symbol</span><span class="token punctuation">.</span><span class="token property-access">toPrimitive</span><span class="token punctuation">]</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token keyword">function</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token parameter">i</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"> </span><span class="token keyword control-flow">return</span><span class="token plain"> </span><span class="token keyword">function</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"> </span><span class="token keyword control-flow">return</span><span class="token plain"> </span><span class="token operator">++</span><span class="token plain">i</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"> </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 punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">(</span><span class="token number">0</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 punctuation">}</span><span class="token punctuation">;</span></div></pre></div><p>每一次进行等号的比较,就会调用一次 <code>valueOf()</code> 方法,自增 1,所以能成立。 另外,减法也是同理:</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 keyword">const</span><span class="token plain"> a </span><span class="token operator">=</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"> </span><span class="token literal-property property">num</span><span class="token operator">:</span><span class="token plain"> </span><span class="token number">4</span><span class="token punctuation">,</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"> </span><span class="token function-variable function">valueOf</span><span class="token operator">:</span><span class="token plain"> </span><span class="token keyword">function</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token plain"> </span><span class="token punctuation">{</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"> </span><span class="token keyword control-flow">return</span><span class="token plain"> </span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">.</span><span class="token property-access">num</span><span class="token plain"> </span><span class="token operator">-=</span><span class="token plain"> </span><span class="token number">1</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 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 punctuation">}</span><span class="token punctuation">;</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 keyword">const</span><span class="token plain"> res </span><span class="token operator">=</span><span class="token plain"> a </span><span class="token operator">==</span><span class="token plain"> </span><span class="token number">3</span><span class="token plain"> </span><span class="token operator">&amp;&amp;</span><span class="token plain"> a </span><span class="token operator">==</span><span class="token plain"> </span><span class="token number">2</span><span class="token plain"> </span><span class="token operator">&amp;&amp;</span><span class="token plain"> a </span><span class="token operator">==</span><span class="token plain"> </span><span class="token number">1</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation">.</span><span class="token method function property-access">log</span><span class="token punctuation">(</span><span class="token plain">res</span><span class="token punctuation">)</span><span class="token punctuation">;</span></div></pre></div><hr/><p><strong>参考文章:</strong></p><ul><li><a target="_blank" rel="noopener noreferrer" href="https://juejin.im/post/59ad2585f265da246a20e026">📝 JavaScript 运算符规则与隐式类型转换详解<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></li></ul></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-conversion.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: ">2/21/2022 13:47:53</span></div></div></div></div>
</span></div><div class="token-line"><span class="token plain"></span><span class="token keyword">const</span><span class="token plain"> res </span><span class="token operator">=</span><span class="token plain"> a </span><span class="token operator">==</span><span class="token plain"> </span><span class="token number">3</span><span class="token plain"> </span><span class="token operator">&amp;&amp;</span><span class="token plain"> a </span><span class="token operator">==</span><span class="token plain"> </span><span class="token number">2</span><span class="token plain"> </span><span class="token operator">&amp;&amp;</span><span class="token plain"> a </span><span class="token operator">==</span><span class="token plain"> </span><span class="token number">1</span><span class="token punctuation">;</span><span class="token plain"></span></div><div class="token-line"><span class="token plain"></span><span class="token console class-name">console</span><span class="token punctuation">.</span><span class="token method function property-access">log</span><span class="token punctuation">(</span><span class="token plain">res</span><span class="token punctuation">)</span><span class="token punctuation">;</span></div></pre></div><hr/><p><strong>参考文章:</strong></p><ul><li><a target="_blank" rel="noopener noreferrer" href="https://juejin.im/post/59ad2585f265da246a20e026">📝 JavaScript 运算符规则与隐式类型转换详解<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></li></ul></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-conversion.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: ">3/27/2022 17:05:47</span></div></div></div></div>
<script>
window.g_useSSR = true;
window.g_initialProps = {};
</script>

<script src="/javascript-guidebook/umi.6cde7df5.js"></script>
<script src="/javascript-guidebook/umi.b0c512ca.js"></script>
</body>
</html>
Loading

0 comments on commit a5a5cca

Please sign in to comment.