I think it's actually superior to always use the for loop. In many cases a 'self-hosted' JS loop is superior in performance to a native, so forEach is unlikely to be better here. The branch also makes the method harder for a JIT to optimize.