1

I've seen this question about stopping a ES5 forEach loop, which pretty much suggests to use .every() or .some() instead of forEach.

I believe I remember typescript uses shims for old browsers to support for example forEach. Is this correct and if so, can I use .some and .every just as well with the same kind of support as forEach?

Community
  • 1
  • 1
Flion
  • 10,468
  • 13
  • 48
  • 68

2 Answers2

2

I believe I remember typescript uses shims for old browsers to support for example forEach. Is this correct

No. TypeScript has no runtime additions for shimming the compilied JavaScript (beyond the __extends function).

can I use .some and .every just as well with the same kind of support as forEach?

Here is the compatability table : http://kangax.github.io/compat-table/es5/#Array.prototype.some that you need to check for your browser.

basarat
  • 261,912
  • 58
  • 460
  • 511
1

I've found part of the answer already with this ES5 compatibility page, which shows everything from IE9 and up supports .forEach, .every and .some, so no shims are needed for that.

Flion
  • 10,468
  • 13
  • 48
  • 68