each_.each(list, iteratee, [context]) 别名: forEach
<!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>