Skip to content

Commit

Permalink
Site updated: 2019-06-01 14:54:15
Browse files Browse the repository at this point in the history
  • Loading branch information
xxplus committed Jun 1, 2019
1 parent 87eb562 commit 369dadf
Show file tree
Hide file tree
Showing 22 changed files with 218 additions and 271 deletions.
8 changes: 4 additions & 4 deletions 2019/05/22/3 对象/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -250,18 +250,18 @@ <h1 id="遍历总结"><a href="#遍历总结" class="headerlink" title="遍历

<nav id="article-nav">

<a href="/2019/05/22/4 函数/" id="article-nav-newer" class="article-nav-link-wrap">
<a href="/2019/05/22/5 标准库/" id="article-nav-newer" class="article-nav-link-wrap">
<i class="icon-circle-left"></i>
<div class="article-nav-title">

ECMA5 函数
ECMA5 标准库

</div>
</a>


<a href="/2019/05/22/关于 this 指针/" id="article-nav-older" class="article-nav-link-wrap">
<div class="article-nav-title">ECMA5 this指针</div>
<a href="/2019/05/22/Call与Apply/" id="article-nav-older" class="article-nav-link-wrap">
<div class="article-nav-title">ECMA5 CALL APPLY 模拟</div>
<i class="icon-circle-right"></i>
</a>

Expand Down
8 changes: 4 additions & 4 deletions 2019/05/22/4 函数/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -265,18 +265,18 @@ <h1 id="6-立即调用的函数表达式-IIFE"><a href="#6-立即调用的函数

<nav id="article-nav">

<a href="/2019/05/22/7 包装对象 wrapper/" id="article-nav-newer" class="article-nav-link-wrap">
<a href="/2019/05/22/Call与Apply/" id="article-nav-newer" class="article-nav-link-wrap">
<i class="icon-circle-left"></i>
<div class="article-nav-title">

ECMA5 包装对象
ECMA5 CALL APPLY 模拟

</div>
</a>


<a href="/2019/05/22/3 对象/" id="article-nav-older" class="article-nav-link-wrap">
<div class="article-nav-title">ECMA5 对象</div>
<a href="/2019/05/22/7 包装对象 wrapper/" id="article-nav-older" class="article-nav-link-wrap">
<div class="article-nav-title">ECMA5 包装对象</div>
<i class="icon-circle-right"></i>
</a>

Expand Down
18 changes: 9 additions & 9 deletions 2019/05/22/5 标准库/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
<title>ECMA5 标准库 | chochi&#39;s workshop</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="description" content="1 判断某个变量是否为对象123function isObject(value)&amp;#123; return value === Object(value); &amp;#125; 2 对象的键名">
<meta name="keywords" content="-JS">
<meta name="keywords" content="JS">
<meta property="og:type" content="article">
<meta property="og:title" content="ECMA5 标准库">
<meta property="og:url" content="http://yoursite.com/2019/05/22/5 标准库/index.html">
<meta property="og:site_name" content="chochi&#39;s workshop">
<meta property="og:description" content="1 判断某个变量是否为对象123function isObject(value)&amp;#123; return value === Object(value); &amp;#125; 2 对象的键名">
<meta property="og:locale" content="default">
<meta property="og:updated_time" content="2019-06-01T06:10:11.362Z">
<meta property="og:updated_time" content="2019-06-01T06:26:23.123Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="ECMA5 标准库">
<meta name="twitter:description" content="1 判断某个变量是否为对象123function isObject(value)&amp;#123; return value === Object(value); &amp;#125; 2 对象的键名">
Expand Down Expand Up @@ -183,8 +183,8 @@ <h1 id="4-属性描述对象"><a href="#4-属性描述对象" class="headerlink"
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 使用属性描述对象定义或修改一个属性</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">var</span> obj = <span class="built_in">Object</span>.defineProperty(&#123;&#125;,<span class="string">'p'</span>,&#123;</span><br><span class="line"> value:<span class="number">123</span>,</span><br><span class="line"> writable:<span class="literal">false</span>,</span><br><span class="line"> enumerable:<span class="literal">true</span>,</span><br><span class="line"> configurable:<span class="literal">false</span></span><br><span class="line">&#125;);</span><br><span class="line">obj.p=<span class="number">456</span>;</span><br><span class="line">obj.p; <span class="comment">//123</span></span><br></pre></td></tr></table></figure>
<ul>
<li>若一个属性的enumerable为false,以下操作不会取到该属性<ul>
<li>for in</li>
<li>Object.keys</li>
<li><code>for ... in</code></li>
<li><code>Object.keys()</code></li>
</ul>
</li>
</ul>
Expand All @@ -209,7 +209,7 @@ <h1 id="6-控制对象的状态"><a href="#6-控制对象的状态" class="heade
<ul class="article-tag-list">

<li class="article-tag-list-item">
<a href="javascript:void(0)" class="js-tag article-tag-list-link color4">-JS</a>
<a href="javascript:void(0)" class="js-tag article-tag-list-link color3">JS</a>
</li>

</ul>
Expand Down Expand Up @@ -239,18 +239,18 @@ <h1 id="6-控制对象的状态"><a href="#6-控制对象的状态" class="heade

<nav id="article-nav">

<a href="/2019/05/22/关于 this 指针/" id="article-nav-newer" class="article-nav-link-wrap">
<a href="/2019/05/22/9 JavaScript Classes/" id="article-nav-newer" class="article-nav-link-wrap">
<i class="icon-circle-left"></i>
<div class="article-nav-title">

ECMA5 this指针
ECMA6 类

</div>
</a>


<a href="/2019/05/22/6 Array/" id="article-nav-older" class="article-nav-link-wrap">
<div class="article-nav-title">ECMA5 数组</div>
<a href="/2019/05/22/3 对象/" id="article-nav-older" class="article-nav-link-wrap">
<div class="article-nav-title">ECMA5 对象</div>
<i class="icon-circle-right"></i>
</a>

Expand Down
8 changes: 4 additions & 4 deletions 2019/05/22/6 Array/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -421,18 +421,18 @@ <h1 id="3-example"><a href="#3-example" class="headerlink" title="3 example"></a

<nav id="article-nav">

<a href="/2019/05/22/5 标准库/" id="article-nav-newer" class="article-nav-link-wrap">
<a href="/2019/05/22/关于 this 指针/" id="article-nav-newer" class="article-nav-link-wrap">
<i class="icon-circle-left"></i>
<div class="article-nav-title">

ECMA5 标准库
ECMA5 this指针

</div>
</a>


<a href="/2019/05/22/Call与Apply/" id="article-nav-older" class="article-nav-link-wrap">
<div class="article-nav-title">ECMA5 CALL APPLY 模拟</div>
<a href="/2019/05/22/9 面向对象编程/" id="article-nav-older" class="article-nav-link-wrap">
<div class="article-nav-title">ECMA5 面向对象编程</div>
<i class="icon-circle-right"></i>
</a>

Expand Down
8 changes: 4 additions & 4 deletions 2019/05/22/7 包装对象 wrapper/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -256,18 +256,18 @@ <h3 id="3-4-字符串的实例方法"><a href="#3-4-字符串的实例方法" cl

<nav id="article-nav">

<a href="/2019/05/22/继承/" id="article-nav-newer" class="article-nav-link-wrap">
<a href="/2019/05/22/4 函数/" id="article-nav-newer" class="article-nav-link-wrap">
<i class="icon-circle-left"></i>
<div class="article-nav-title">

ECMA5 继承
ECMA5 函数

</div>
</a>


<a href="/2019/05/22/4 函数/" id="article-nav-older" class="article-nav-link-wrap">
<div class="article-nav-title">ECMA5 函数</div>
<a href="/2019/05/22/关于 this 指针/" id="article-nav-older" class="article-nav-link-wrap">
<div class="article-nav-title">ECMA5 this指针</div>
<i class="icon-circle-right"></i>
</a>

Expand Down
8 changes: 4 additions & 4 deletions 2019/05/22/9 JavaScript Classes/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -236,18 +236,18 @@ <h1 id="Questions"><a href="#Questions" class="headerlink" title="Questions"></a

<nav id="article-nav">

<a href="/2019/05/22/Call与Apply/" id="article-nav-newer" class="article-nav-link-wrap">
<a href="/2019/05/22/继承/" id="article-nav-newer" class="article-nav-link-wrap">
<i class="icon-circle-left"></i>
<div class="article-nav-title">

ECMA5 CALL APPLY 模拟
ECMA5 继承

</div>
</a>


<a href="/2019/05/22/9 面向对象编程/" id="article-nav-older" class="article-nav-link-wrap">
<div class="article-nav-title">ECMA5 面向对象编程</div>
<a href="/2019/05/22/5 标准库/" id="article-nav-older" class="article-nav-link-wrap">
<div class="article-nav-title">ECMA5 标准库</div>
<i class="icon-circle-right"></i>
</a>

Expand Down
4 changes: 2 additions & 2 deletions 2019/05/22/9 面向对象编程/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,11 @@ <h1 id="跳-对象的相关方法"><a href="#跳-对象的相关方法" class="h

<nav id="article-nav">

<a href="/2019/05/22/9 JavaScript Classes/" id="article-nav-newer" class="article-nav-link-wrap">
<a href="/2019/05/22/6 Array/" id="article-nav-newer" class="article-nav-link-wrap">
<i class="icon-circle-left"></i>
<div class="article-nav-title">

ECMA6 类
ECMA5 数组

</div>
</a>
Expand Down
26 changes: 13 additions & 13 deletions 2019/05/22/Call与Apply/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@
<link rel="dns-prefetch" href="http://yoursite.com">
<title>ECMA5 CALL APPLY 模拟 | chochi&#39;s workshop</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="description" content="概念 每个函数都包括两个非继承而来的方法 apply call 在特定的作用域中调用函数,实际上等于设置函数体内this对象的值 看出 call 和 apply 是为了动态改变 this 而出现的区别 apply() 接受两个参数,第一个是运行函数的作用域,第二个是参数数组,参数数组可以用arrar实例,也可以是arguments对象。 call() 参数必须逐个列出来 call">
<meta name="keywords" content="-JS">
<meta name="description" content="概念 每个函数都包括两个非继承而来的方法 apply call 在特定的作用域中调用函数,实际上等于设置函数体内this对象的值 看出 call 和 apply 是为了动态改变 this 而出现的区别 apply() 接受两个参数,第一个是运行函数的作用域,第二个是参数数组,参数数组可以用arrary实例,也可以是arguments对象。 call() 参数必须逐个列出来 call">
<meta name="keywords" content="JS">
<meta property="og:type" content="article">
<meta property="og:title" content="ECMA5 CALL APPLY 模拟">
<meta property="og:url" content="http://yoursite.com/2019/05/22/Call与Apply/index.html">
<meta property="og:site_name" content="chochi&#39;s workshop">
<meta property="og:description" content="概念 每个函数都包括两个非继承而来的方法 apply call 在特定的作用域中调用函数,实际上等于设置函数体内this对象的值 看出 call 和 apply 是为了动态改变 this 而出现的区别 apply() 接受两个参数,第一个是运行函数的作用域,第二个是参数数组,参数数组可以用arrar实例,也可以是arguments对象。 call() 参数必须逐个列出来 call">
<meta property="og:description" content="概念 每个函数都包括两个非继承而来的方法 apply call 在特定的作用域中调用函数,实际上等于设置函数体内this对象的值 看出 call 和 apply 是为了动态改变 this 而出现的区别 apply() 接受两个参数,第一个是运行函数的作用域,第二个是参数数组,参数数组可以用arrary实例,也可以是arguments对象。 call() 参数必须逐个列出来 call">
<meta property="og:locale" content="default">
<meta property="og:updated_time" content="2019-05-22T14:54:34.598Z">
<meta property="og:updated_time" content="2019-06-01T06:53:45.963Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="ECMA5 CALL APPLY 模拟">
<meta name="twitter:description" content="概念 每个函数都包括两个非继承而来的方法 apply call 在特定的作用域中调用函数,实际上等于设置函数体内this对象的值 看出 call 和 apply 是为了动态改变 this 而出现的区别 apply() 接受两个参数,第一个是运行函数的作用域,第二个是参数数组,参数数组可以用arrar实例,也可以是arguments对象。 call() 参数必须逐个列出来 call">
<meta name="twitter:description" content="概念 每个函数都包括两个非继承而来的方法 apply call 在特定的作用域中调用函数,实际上等于设置函数体内this对象的值 看出 call 和 apply 是为了动态改变 this 而出现的区别 apply() 接受两个参数,第一个是运行函数的作用域,第二个是参数数组,参数数组可以用arrary实例,也可以是arguments对象。 call() 参数必须逐个列出来 call">

<link rel="alternative" href="/atom.xml" title="chochi&#39;s workshop" type="application/atom+xml">

Expand Down Expand Up @@ -170,7 +170,7 @@ <h1 id="概念"><a href="#概念" class="headerlink" title="概念"></a>概念</
</ul>
<ol>
<li>apply()<ul>
<li>接受两个参数,第一个是运行函数的作用域,第二个是参数数组,参数数组可以用arrar实例,也可以是arguments对象。</li>
<li>接受两个参数,第一个是运行函数的作用域,第二个是参数数组,参数数组可以用arrary实例,也可以是arguments对象。</li>
</ul>
</li>
<li>call()<ul>
Expand All @@ -179,9 +179,9 @@ <h1 id="概念"><a href="#概念" class="headerlink" title="概念"></a>概念</
</li>
</ol>
<h1 id="call-模拟"><a href="#call-模拟" class="headerlink" title="call 模拟"></a>call 模拟</h1><ul>
<li>参数一一对应</li>
<li>参数一一对应(没有做一些错误机制的判断处理)</li>
</ul>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">Function</span>.prototype.myCall = <span class="function"><span class="keyword">function</span>(<span class="params">_context</span>)</span>&#123;</span><br><span class="line"> <span class="keyword">let</span> context = _context || <span class="built_in">window</span>;<span class="comment">// null -&gt; window</span></span><br><span class="line"> context.fn = <span class="keyword">this</span>;</span><br><span class="line"> <span class="keyword">let</span> args = [].slice.call(<span class="built_in">arguments</span>,<span class="number">1</span>,<span class="built_in">arguments</span>.length);</span><br><span class="line"> <span class="keyword">let</span> result = !args ?context.fn():context.fn(...args); </span><br><span class="line"> <span class="keyword">delete</span> context.fn;</span><br><span class="line"> <span class="keyword">return</span> result;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">Function</span>.prototype.myCall = <span class="function"><span class="keyword">function</span>(<span class="params"></span>)</span>&#123;</span><br><span class="line"> </span><br><span class="line"> <span class="keyword">let</span> args = <span class="built_in">Array</span>.from(<span class="built_in">arguments</span>);</span><br><span class="line"></span><br><span class="line"> <span class="keyword">const</span> context = args.shift() || <span class="built_in">window</span>; <span class="comment">// null -&gt; window</span></span><br><span class="line"> context.callFun = <span class="keyword">this</span>; <span class="comment">// 将函数设置为该对象的一个属性</span></span><br><span class="line"></span><br><span class="line"> <span class="keyword">let</span> result = !args ?context.callFun() : context.callFun(...args); </span><br><span class="line"> <span class="keyword">delete</span> context.callFun;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">return</span> result;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<a id="more"></a>
<ul>
<li>参数是数组</li>
Expand All @@ -204,7 +204,7 @@ <h1 id="参考文献"><a href="#参考文献" class="headerlink" title="参考
<ul class="article-tag-list">

<li class="article-tag-list-item">
<a href="javascript:void(0)" class="js-tag article-tag-list-link color4">-JS</a>
<a href="javascript:void(0)" class="js-tag article-tag-list-link color3">JS</a>
</li>

</ul>
Expand Down Expand Up @@ -234,18 +234,18 @@ <h1 id="参考文献"><a href="#参考文献" class="headerlink" title="参考

<nav id="article-nav">

<a href="/2019/05/22/6 Array/" id="article-nav-newer" class="article-nav-link-wrap">
<a href="/2019/05/22/3 对象/" id="article-nav-newer" class="article-nav-link-wrap">
<i class="icon-circle-left"></i>
<div class="article-nav-title">

ECMA5 数组
ECMA5 对象

</div>
</a>


<a href="/2019/05/22/9 JavaScript Classes/" id="article-nav-older" class="article-nav-link-wrap">
<div class="article-nav-title">ECMA6 类</div>
<a href="/2019/05/22/4 函数/" id="article-nav-older" class="article-nav-link-wrap">
<div class="article-nav-title">ECMA5 函数</div>
<i class="icon-circle-right"></i>
</a>

Expand Down
8 changes: 4 additions & 4 deletions 2019/05/22/关于 this 指针/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -219,18 +219,18 @@ <h2 id="2-加一个关于箭头函数的this指针"><a href="#2-加一个关于

<nav id="article-nav">

<a href="/2019/05/22/3 对象/" id="article-nav-newer" class="article-nav-link-wrap">
<a href="/2019/05/22/7 包装对象 wrapper/" id="article-nav-newer" class="article-nav-link-wrap">
<i class="icon-circle-left"></i>
<div class="article-nav-title">

ECMA5 对象
ECMA5 包装对象

</div>
</a>


<a href="/2019/05/22/5 标准库/" id="article-nav-older" class="article-nav-link-wrap">
<div class="article-nav-title">ECMA5 标准库</div>
<a href="/2019/05/22/6 Array/" id="article-nav-older" class="article-nav-link-wrap">
<div class="article-nav-title">ECMA5 数组</div>
<i class="icon-circle-right"></i>
</a>

Expand Down
4 changes: 2 additions & 2 deletions 2019/05/22/继承/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ <h4 id="2-5-寄生组合继承"><a href="#2-5-寄生组合继承" class="headerl
</a>


<a href="/2019/05/22/7 包装对象 wrapper/" id="article-nav-older" class="article-nav-link-wrap">
<div class="article-nav-title">ECMA5 包装对象</div>
<a href="/2019/05/22/9 JavaScript Classes/" id="article-nav-older" class="article-nav-link-wrap">
<div class="article-nav-title">ECMA6 类</div>
<i class="icon-circle-right"></i>
</a>

Expand Down
Loading

0 comments on commit 369dadf

Please sign in to comment.