"for (i in myArray)" produces unintentional side effects if a test modifies Array.prototype or Object.prototype. Use for (i=0; __; i++) instead.

This commit is contained in:
pschwartau%netscape.com 2001-04-18 22:33:31 +00:00
Родитель 25d8b4b4be
Коммит 38c1d1eb9c
2 изменённых файлов: 8 добавлений и 8 удалений

Просмотреть файл

@ -40,8 +40,8 @@ function reportFailure (msg)
var funcName = currentFunc(); var funcName = currentFunc();
var prefix = (funcName) ? "[reported from " + funcName + "] ": ""; var prefix = (funcName) ? "[reported from " + funcName + "] ": "";
for (l in lines) for (var i=0; i<lines.length; i++)
print (FAILED + prefix + lines[l]); print (FAILED + prefix + lines[i]);
} }
@ -53,8 +53,8 @@ function printStatus (msg)
var lines = msg.split ("\n"); var lines = msg.split ("\n");
var l; var l;
for (l in lines) for (var i=0; i<lines.length; i++)
print (STATUS + lines[l]); print (STATUS + lines[i]);
} }

Просмотреть файл

@ -40,8 +40,8 @@ function reportFailure (msg)
var funcName = currentFunc(); var funcName = currentFunc();
var prefix = (funcName) ? "[reported from " + funcName + "] ": ""; var prefix = (funcName) ? "[reported from " + funcName + "] ": "";
for (l in lines) for (var i=0; i<lines.length; i++)
print (FAILED + prefix + lines[l]); print (FAILED + prefix + lines[i]);
} }
@ -53,8 +53,8 @@ function printStatus (msg)
var lines = msg.split ("\n"); var lines = msg.split ("\n");
var l; var l;
for (l in lines) for (var i=0; i<lines.length; i++)
print (STATUS + lines[l]); print (STATUS + lines[i]);
} }