영어 작문 초딩입니다. 제가 아래의 글을 - TopicsExpress



          

영어 작문 초딩입니다. 제가 아래의 글을 작성했는데 이상한 부분 지적 좀 마구마구해주세요. --- You cant call a String because a String is not a Function. String may be called if you use a eval function, but It seems not to be final answer for your wanting to know. var object = { param1: 0, param2: 0, function1: param1 += 1;, function2: param2 = new Date().getTime(); }; Unfortunately, this code has a binding problem. params can not be found since eval has a different context. Theres an excellent answer Christophe L has commented above. I think that we can clear eval context problem, getting some minor editing to do. All that we have to do is get the context of newFunc to be bound object. You can see it on the following code var array = []; var object = { param1: 0, param2: 0, function1: function(){ this.param1 += 1; }, function2: function(){ this.param2 = new Date().getTime(); } }; for(var i=0; i
Posted on: Sun, 03 Aug 2014 01:51:25 +0000

Trending Topics



Recently Viewed Topics




© 2015