Javascript scope question

  • This one maybe because of my ignorance.. 

    I do not understand why scopeD(1) below returns 1 even though i has been set to 2?


    especially as the following scopeC(1) returns 2?

    I am very confused by javascript scoping - help??

  • Ok I found the answer here (very useful article actually for this exam!)