javascript - how to prevent the overwriting in arrays -
i thinking short out problem of global variable. thinking method messing connect chains of question want function prevents 1 overwrite on present index of array
window.abc[0] = "first";
now after writing many lines of code mistakably write same code different value such as:
window.abc[0] = "second";
then function should come , put second
on index 1 second
should put in window.abc[1]
.
thanks.
if use "push" method array index automatically increase :)
kevin
Comments
Post a Comment