• A JavaScript interview question which can be fixed by 'let'

    A very popular JavaScript interview question on Lexical scope and closure is like the follow.

  • Minimize the price (not the benefit) of type in Typescript

    I watched Anders Hejlsberg introducing typescript in 2012. Then I thought I don't have the problem it tries to solve. Type in Javascript has not yet caused any problem for me, as I have unit test, renaming and intellisense is also not a problem for me, because I have webstorm. Then, I found that Douglas Crockford said something in google plus

  • TypeScript is duck typing.

    When I see a bird that walks like a duck and swims like a duck and quacks like a duck, I call that bird a duck.
  • Leave $rootScope alone, use AngularJs Dependency Injection.

    AngularJs brings dependency injection into UI development. It works very well until it is misused. Recently, I was working on an AngularJs project. One interesting thing is that some application settings is attached to $rootScope for convenient consumption. When I saw it, I felt this was so Déjà vu. The $rootScope has essentially become the new "window" object in the browser, where all global variables can be attached to. So I Googled about this and wanted to know whether other people have similar problem, and I found this question in StackOverflow, Global variables in AngularJS. It seems that this is a quite a common problem out there. So I wanted dig into it more.

  • Class in ES6, Typescript, Angular2 and Angular1

    ES6 class

    Class was proposed in ECMAScript 4, which was abandoned, and ES5 does not have Class. Now ES6 is finalized and it has class.