for…of – JavaScript keyword Internet Explorer work-around

I am using “for…of” in many places in my Javascript code which is a new technology, part of Javascript’s new specification (ECMAScript 2015 (E56) standard). “for…of” is supported in Chrome, Safari and Firefox. Though, IE doesn’t yet support this new feature (See this link). What would be my best approach to support these 4 main browsers – do I revert to “for in/for loop” or do I use browser-sniffing code or is there a better hack to be able to both use some hybrid “for…of” and “for…in”? This is not a repeat of this question here: link_here because I am aware that IE does not support “for…of”. What I am looking for is if there is a hack to still use it and still support all the 4 browsers I listed?


Source: cross-browser

Leave a Reply