For-each loops in JS are "dangerous" to use on arrays, and I can't simply do
for (var idx in arr)
and instead have to do
for (var idx = 0, len = arr.length; idx < len; ++idx)
which is very laborious to type. Suppose it takes 3 seconds to type and I have to type it 10,000 times in my life ...
3s x 10,000 / 60h = 500h
500h * $28/h = $14,000
It would be better to have a compact way of creating this common line of code. It would be nice to have some preprocessor directive like
#define L(arr,idx,len) for (var idx = 0, len = arr.length; idx < len; ++idx)
and then I could just write stuff like
var myArray = [1, 69, 193912];
L(myArray,k,n)
{
// ...
}
Is this possible?