3 ms·
You have to know both methods and the trade off for each. The performance differences can be quite marked as well. I wrote some code the other day that could
by noir_lord 7y ago
You have to know both methods and the trade off for each.
The performance differences can be quite marked as well.
I wrote some code the other day that could have been done with forEach more readably but I just used regular for loops because I was working with what was effectively a 3D array (grid/cell/contents) and know that for can be nearly twice as fast as foreach.