DEV Community

Discussion on: Which Array Function When?

Collapse
 
darrenkopp profile image
Darren Kopp

Correct, as the forEach call will incur a penalty invoking the lambda expression. forEach could have equivalent performance if the JIT inlines the lamba method body, but it's safe to say always expect forEach to be a bit slower.