javascript - Are these for loops different? -


here code

example 1

for (var k = 0, l = value.length; k < l; k++, index++) {     // ... } 

example 2

var l = value.length; (var k = 0; k < l; k++, index++) {     // ... } 

in example 1, variable l defined inside of 'for' brackets, mean l being defined every time loop goes through? if example 2 more efficient right?

they equal in speed. nothing different.

but recommand use example 2 because better read.


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -