JavaScript array iteration - MDN example -


i reading re-introduction javascript on mdn website , came across example in array section:

for (var = 0, item; item = a[i++];){    // item } 

where "a[]" array being looped over.

i confused value "item" have in first iteration. i=0 , item @ first undefined, when assigned value of a[i++] wouldn't iteration start i=1, mean iteration start second element in a[] array -> a[1], skipping on first element a[0] entirely?

i++ post increment operator, means increments i 1 evaluates old (non-incremented) value.

> = 0   0 > i++   0 >   1 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -