小编fox*_*net的帖子

我需要从对象文字中的子对象调用父属性

我试图从子对象调用父属性

var parentObj = {  
   attr1:1,  
   attr2:2,   
   childObj:{  
      method1:function(){  
         return this.attr1 * this.attr2;  
      }  
   }  
}
Run Code Online (Sandbox Code Playgroud)

但它不起作用.

javascript

23
推荐指数
5
解决办法
2万
查看次数

标签 统计

javascript ×1