上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 44 下一页
摘要: 前2章探索了this绑定指向不同的对象需要函数引用的call-site。 但是什么是对象,为什么我们需要指向它们? 本章探索细节。 Syntax the rules that describe how words and phrases are used in a computer language 阅读全文
posted @ 2018-10-05 19:56 Mr-chen 阅读(177) 评论(0) 推荐(0) 编辑
摘要: this is a binding made for each function invocation, based entirely on its call-site (how the function is called). this是为函数被引用而创建的绑定!完全地基于函数如何被调用/函数的c 阅读全文
posted @ 2018-10-05 11:46 Mr-chen 阅读(224) 评论(0) 推荐(0) 编辑
摘要: Foreword this 关键字和prototypes 他们是用JS编程的基础。没有他们创建复杂的JS程序是不可能的。 我敢说大量的web developers从没有建立过JS Object,仅仅对待这门语言作为一个事件绑定胶水,在按钮和Ajax请求之间。 我也曾是他们的一员,但是当我了解到如何掌 阅读全文
posted @ 2018-10-04 22:10 Mr-chen 阅读(195) 评论(0) 推荐(0) 编辑
摘要: JavaScript只有Lexical Scope 模式 Lexical Scope就是在写代码的时候,定义函数的时候创建的作用域! 而动态作用域是在runtime时,函数被调用的地方的作用域! 实际上 dynamic Scope是 this关键字的近亲。这会在this & Object Proto 阅读全文
posted @ 2018-10-04 18:07 Mr-chen 阅读(348) 评论(0) 推荐(0) 编辑
摘要: Chapter 5: Scope Closure 我们到达这里时,已经对作用域如何工作有了非常健康稳固的理解。 下面,我们转移注意力到一个及其重要,但长期难以理解,几乎是神话中的部分语言:Closure! Enlightenment💡启发 那些有使用JS的经验,但没有完全抓住closures的概念 阅读全文
posted @ 2018-10-03 13:58 Mr-chen 阅读(238) 评论(0) 推荐(0) 编辑
摘要: Chapter4: Hoisting 变量附加到哪个层次的scope,由它们在哪里和如何声明(let, var)来决定。 Function scope/Block scope都有相同的法则:任何变量在一个scope内声明,则这个变量附加到这个作用域上。 但有一个细节问题:当声明declaration 阅读全文
posted @ 2018-10-03 13:50 Mr-chen 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 第二章,作用域由一系列的bubbles组成。每一个都代表了一个container或bucket,装着被声明的identifiers(variables, functions)。这些bubbles相互嵌套。这种嵌套是在开发阶段写完的。 什么制造了一个新的bubble? 只是函数吗?其他的JS结构可以创 阅读全文
posted @ 2018-10-02 21:49 Mr-chen 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 2种主要的models for how scope work. 最普遍的是Lexical Scope. 另一种 Dynamic Scope。(在Appendix a中介绍。和Lexical Scope 进行对比) Lex-time lexical scope is scope that is def 阅读全文
posted @ 2018-10-02 18:21 Mr-chen 阅读(283) 评论(0) 推荐(0) 编辑
摘要: Content Appendix: Chapter1: What is Scope? In fact, the ability to store values and pull values out of variables is what gives a program state. 背后的问题: 阅读全文
posted @ 2018-10-02 15:30 Mr-chen 阅读(220) 评论(0) 推荐(0) 编辑
摘要: 树型图 本示例是一个简单的树形视图实现,它展现了组件的递归使用。 mycode pen: https://codepen.io/chentianwei411/pen/KGKQxE 重点:递归是如何形成的。嵌套组件!! 如果不使用嵌套组件,而使用<li>元素的话,不会形成递归效果。 基本结构: 功能: 阅读全文
posted @ 2018-09-29 10:10 Mr-chen 阅读(1638) 评论(0) 推荐(0) 编辑
上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 44 下一页