26 Matching Annotations
  1. Aug 2016
  2. Jul 2016
    1. i: 22

      Q: i和arguments[0]是相互独立的吗?如果我修改arguments[0], i会保持原来的值么?

      A: 下面Q&A部分有解释。i和arguments[0]应该reference to each other。

      但是究竟什么是reference to each other? 如果是object,我可以理解它们都reference到同一个object。但是如果是primitive呢?

    1. Indeed, any object that uses the Fruit () constructor will inherit all the Fruit.prototype properties and methods and all the properties and methods from the Fruit’s prototype, which is Plant.prototype.

      How this inheritance is implemented? Does it suggest that Fruit's prototype will hold a reference of Plant's prototye?

      Q: Why Fruit's prototype is Plant.prototype instead of the Plant object? A: Because aBanana.showNameAndColor().

      If Fruit.prototype is Plant.prototype, then shouldn't every object's prototype is just a reference of the Object.prototype?

  3. Jun 2016
    1. The this keyword evaluates to the value of the ThisBinding of the current execution context.

      这句话在暗示this其实和ThisBinding的值是不一样的?

      那么在Execution Context里面存的究竟是this还是ThiBinding呢?

    2. this value is taken from the this value of the calling execution context

      这个其实更好理解。

    3. a.b(); //window

      这个很tricky啊

      如果在b里面把this打印出来,那么this应该为a; 但是这个例子打印的是c()里面的this,而c()是被baseless地call的。

    4. foo

      foo() 在global定义和在function里面定义有区别的吗?

    5. Baseless

      啥叫作baseless function call 呀?

    6. There are three types of execution context: global, function and evaluation

      evaluation 这种Exectution Context还没有研究过。。。

    1. scope object

      不要自创名词好不好?!

      作者这里的Scope Object听起来像是VO和Scope chain的混合体。当然,作者可以说是lexical environments,但不能说是LexicalEnvironment!!! 改词是reserved的!!

    1. partial function application

      这个bind的用法很有意思,在很多地方都见过。我理解它的优势是可以修改函数的args列表,产生新函数。

    2. function declarations have two advantages over function expressions

      以我目前的知识,除了call back,还没想到很好的function expression的例子……

    3. constructor Function()

      下文不建议使用Function()

    4. The Three Roles of Functions in JavaScript

      感觉这三个role的主要区别是this的值

      • Nonmethod function

      this指向Global Object

      • Constructor

      this指向新建的Object

      • Method

      this指向method所属的Object

    1. The two cornerstones of Ajax are loading content asynchronously in the background (via XMLHttpRequest) and dynamically updating the current page with the results (via dynamic HTML).

      终于有点明白AJAX是干什么的了

    1. JavaScript does not have integers

      这对我们平时的使用有啥影响么?

    2. Influences

      学好多门语言才能精通一门……

    3. It’s dynamically typed

      无法从function的signature看出使用function的方法。这暗示说JS的文档很重要咯?

    4. Prototypes

      我目前还不清楚Prototype有什么benefits。

    5. arrays in JavaScript are too flexible: they are not indexed sequences of elements, but maps from numbers to elements.

      有意思 居然这么写……

    6. JavaScript is always deployed as source code and compiled by JavaScript engines.

      突然意识到,JS的source code deployment方式也许是对JS engine不统一的一种妥协。

    7. It fails silently

      作为早期只在Browser里面跑的语言,JS的确应该fail silently。但是,随着NodeJS等server端JS兴起,这种特点就不合适了。

    8. functional programming (first-class functions, closures, partial application via bind(), built-in map() and reduce() for arrays, etc.)

      很全面的Functional Programming特点的总结

    9. And you can directly create objects, without creating an object factory (e.g., a class) first

      这个很有特点,直接使用{...}来建立新Object