admin管理员组文章数量:1026989
After reading documentation of underscore.js
I found (to my surprise) that actually not all browsers support
forEach
filter
every
some
methods. Previously I thought that these methods are implemented everywhere. Checking what browsers does not support them, did not give me any information: my chrome, IE9, firefox 13
all supports them.
So where can I find what browsers support them and may be what other methods are not supported everywhere?
P.S I am sorry, I think I confused someone with my question. I know that all browsers support underscore's foreach. In the question I refer to native methods.
After reading documentation of underscore.js
I found (to my surprise) that actually not all browsers support
forEach
filter
every
some
methods. Previously I thought that these methods are implemented everywhere. Checking what browsers does not support them, did not give me any information: my chrome, IE9, firefox 13
all supports them.
So where can I find what browsers support them and may be what other methods are not supported everywhere?
P.S I am sorry, I think I confused someone with my question. I know that all browsers support underscore's foreach. In the question I refer to native methods.
Share Improve this question edited Oct 13, 2015 at 5:40 user3335966 2,7454 gold badges32 silver badges33 bronze badges asked Nov 9, 2012 at 13:00 Salvador DaliSalvador Dali 223k151 gold badges724 silver badges765 bronze badges 2- possible duplicate of What's the current status of Javascript ES5? – Bergi Commented Nov 9, 2012 at 13:08
- Sure, the question are not the same (because you only asked for a part of ES5), but I wanted to link it for others – Bergi Commented Nov 9, 2012 at 13:28
4 Answers
Reset to default 12here is a nice patibility table: http://kangax.github./es5-pat-table/
I normally take a look at http://kangax.github./es5-pat-table/ which has a pretty good table off support for allot of javascript methods.
They ave been around for some time. JavaScriptKit is a good resource.
All modern browsers with JavaScript 1.6+ support implement these methods.
Javascriptkit: Arrays
All browsers will support underscore's methods forEach
, filter
, every
and some
(and any other methods). It is just that some of them will be not as efficient because they don't have native counterparts.
As an example, check forEach
: underscore first checks if the Array
prototype supports forEach
natively with nativeForEach = ArrayProto.forEach
. If it does, it uses the native prototype method. If not, it uses it's own implementation with a for
loop (in collection functions, see var each = _.each = _.forEach = function(obj, iterator, context) ...
.
After reading documentation of underscore.js
I found (to my surprise) that actually not all browsers support
forEach
filter
every
some
methods. Previously I thought that these methods are implemented everywhere. Checking what browsers does not support them, did not give me any information: my chrome, IE9, firefox 13
all supports them.
So where can I find what browsers support them and may be what other methods are not supported everywhere?
P.S I am sorry, I think I confused someone with my question. I know that all browsers support underscore's foreach. In the question I refer to native methods.
After reading documentation of underscore.js
I found (to my surprise) that actually not all browsers support
forEach
filter
every
some
methods. Previously I thought that these methods are implemented everywhere. Checking what browsers does not support them, did not give me any information: my chrome, IE9, firefox 13
all supports them.
So where can I find what browsers support them and may be what other methods are not supported everywhere?
P.S I am sorry, I think I confused someone with my question. I know that all browsers support underscore's foreach. In the question I refer to native methods.
Share Improve this question edited Oct 13, 2015 at 5:40 user3335966 2,7454 gold badges32 silver badges33 bronze badges asked Nov 9, 2012 at 13:00 Salvador DaliSalvador Dali 223k151 gold badges724 silver badges765 bronze badges 2- possible duplicate of What's the current status of Javascript ES5? – Bergi Commented Nov 9, 2012 at 13:08
- Sure, the question are not the same (because you only asked for a part of ES5), but I wanted to link it for others – Bergi Commented Nov 9, 2012 at 13:28
4 Answers
Reset to default 12here is a nice patibility table: http://kangax.github./es5-pat-table/
I normally take a look at http://kangax.github./es5-pat-table/ which has a pretty good table off support for allot of javascript methods.
They ave been around for some time. JavaScriptKit is a good resource.
All modern browsers with JavaScript 1.6+ support implement these methods.
Javascriptkit: Arrays
All browsers will support underscore's methods forEach
, filter
, every
and some
(and any other methods). It is just that some of them will be not as efficient because they don't have native counterparts.
As an example, check forEach
: underscore first checks if the Array
prototype supports forEach
natively with nativeForEach = ArrayProto.forEach
. If it does, it uses the native prototype method. If not, it uses it's own implementation with a for
loop (in collection functions, see var each = _.each = _.forEach = function(obj, iterator, context) ...
.
本文标签:
版权声明:本文标题:javascript - what browsers do not support native forEach, filter, every and so on - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1740296056a1746858.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论