使用 Immutable.js 获取列表的枚举

Get a enumeration of a list with Immutable.js

对于 "a"、"b"、"c" 的列表,我想对其索引进行迭代,如 Python 代码。我该怎么做?我希望是 ES5 代码。

for index,val in enumerate(["a","b","c"]): print index,val
0 a
1 b
2 c

var list = Immutable.List(['a', 'b', 'c']); list.forEach(function(value, index){console.log(value, index)});

请注意,它将 return 列表的长度。