Javascript automatic getter/setters (John Resig Book)

前端 未结 8 630
陌清茗
陌清茗 2020-12-14 03:02

I\'m reading \"Pro Javascript Techniques\" from John Resig, and I\'m confused with an example. This is the code:

// Create a new user object that accepts an          


        
8条回答
  •  [愿得一人]
    2020-12-14 03:26

    Maybe the variable i is "closured" with the last value in the iteration ("age")? Then all getters and setters will access properties["age"].

提交回复
热议问题