首页 > 其他 > 详细

each_.each(list, iteratee, [context]) 别名: forEach

时间:2016-04-09 21:51:57      阅读:264      评论:0      收藏:0      [点我收藏+]
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head>
	<title></title>
	<script type="text/javascript" src="underscore.js"></script>

</head>

<script type="text/javascript">
	 // _.each([1, 2, 3], a);  
	 // _.each({one: 1, two: 2, three: 3}, alert);
	 var obj=function(){
        this.a;
        this.b;
        this.c;

        this.a=4;
        this.b=5;
        this.c=6;
	 }

	 obj.prototype.fun=function(value){
         console.log(value);
       
	 }
      
      obj.prototype.say = function() {
         _.each([this.a, this.b, this.c],this.fun);
      };

      obj=new obj();
	  obj.say();
</script>
<body>

</body>
</html>

 

each_.each(list, iteratee, [context]) 别名: forEach

原文:http://www.cnblogs.com/itphp/p/5372608.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!