ExtJS中是否有map()函数? [英] Is there a map() function in ExtJS?
问题描述
我已经尝试过,但没有找到任何可以填补这个角色。这似乎是一件简单而简单的事情,一个像Ext这样大的JS库必须有。
或者Ext真的不包括它,那会是什么最好的方法来添加到Ext。当然,我可以写:
Ext.map = function(arr,f){...};
但这真的是正确的方法吗?
看来,我这里的大学正在使用 ext-basex ,它使用map()和其他方法扩展了Array.prototype。
所以我可以写:
[1,2,3] .map(function(){...});
问题解决。
ExtJS has Ext.each() function, but is there a map() also hidden somewhere?
I have tried hard, but haven't found anything that could fill this role. It seems to be something simple and trivial, that a JS library so large as Ext clearly must have.
Or when Ext really doesn't include it, what would be the best way to add it to Ext. Sure, I could just write:
Ext.map = function(arr, f) { ... };
But is this really the correct way to do this?
It appears, that my colleges here are using ext-basex, which extends Array.prototype with map() and other methods.
So I can just write:
[1, 2, 3].map( function(){ ... } );
Problem solved.
这篇关于ExtJS中是否有map()函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!