码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2016-04-09 21:54:18      阅读:151      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!