L
L
lagudal2020-05-11 21:55:59
JavaScript
lagudal, 2020-05-11 21:55:59

How to properly convert code to es5?

There is a code like this, I translate to es5 using babel,
it still does not work in ie 11.
If I understand correctly, the problem remains in the forEach loops, which I see 2? If it's easy, plz tell me how to fix it? What is the most concise way to replace forEach in this example.
Thanks

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
shsv382, 2020-05-11
@shsv382

You need to either configure Babel for IE-11, or use a polyfill like es5-shim

D
Dmitry, 2020-05-11
@dimoff66

forEach is most concisely replaced by the for ... of ... construct, in fact, if forEach is used for ready-made code and a variable containing a function reference is not passed to it, then it is always more beautiful to use for .. of, since it allows you to break the loop when necessary and, in principle, looks more neat or something

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question