No one says that forEach() is faster than for...loop. For the same piece of code for..loop will be always faster then forEach() method unless we make any mistake in our code.
The above example code snippets for for..loop are written in such a way that, we can understand what can happen if we make this kind of mistake in our code.
No one says that
forEach()
is faster thanfor...loop
. For the same piece of codefor..loop
will be always faster thenforEach()
method unless we make any mistake in our code.The above example code snippets for
for..loop
are written in such a way that, we can understand what can happen if we make this kind of mistake in our code.Hmm. Thanks for writing the post.
Thanks for giving me the feedback.