數組對象支持 forEach:
> a = ['1','2','3','4']
[ '1', '2', '3', '4' ]
> a.forEach(function(item){console.log(item)})
1
2
3
4
數組對象不支持 each:
> a
[ '1', '2', '3', '4' ]
> a.each(function(item){console.log(item)})
TypeError: undefined is not a function
at repl:1:3
at REPLServer.defaultEval (repl.js:132:27)
at bound (domain.js:254:14)
at REPLServer.runBound [as eval] (domain.js:267:12)
at REPLServer.<anonymous> (repl.js:279:12)
at REPLServer.emit (events.js:107:17)
at REPLServer.Interface._onLine (readline.js:214:10)
at REPLServer.Interface._line (readline.js:553:8)
at REPLServer.Interface._ttyWrite (readline.js:830:14)
at ReadStream.onkeypress (readline.js:109:10)
Nodejs 之 forEach
http://blog.csdn.net/jklfjsdj79hiofo/article/details/7847249