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. a.b(); //window

      这个很tricky啊

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

    1. scope object

      不要自创名词好不好?!

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

    1. 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 is always deployed as source code and compiled by JavaScript engines.

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

    2. It fails silently

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

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

      很全面的Functional Programming特点的总结