为什么我在犀牛中不能使用Array.filter()
?在Rhino中没有Array.filter()?
的代码是这样的:
var simple_reason = ["a", "b", "c"];
print(typeof simple_reason.filter);
var not_so_simple_reason = new Array("a", "b", "c");
print(typeof not_so_simple_reason.filter);
两种情况输出 “未定义”。
您使用的是什么版本的Rhino?当我在1.7中运行它时,我得到了两种情况下的“函数”(除非您更改数组,否则它们的方式完全相同)。 – 2009-11-25 19:49:16
我在哪里可以看到版本? – 2009-11-26 13:15:07
当您以交互方式启动它(即没有要运行的文件)时,它应该在启动时打印该版本。 – 2009-11-26 23:29:55