javascript - bizzare undefined variable -


I have a multi-dimensional array in which there are objects, and if I am in a particular property, then I I want to remove

COFFEESCRIPT

  For the data columns in the Bent Spinner for all data columns, I have data in column console.log i, brentSpiner.refreshRate # DataColumn.remove i If BrentSpinner .refreshRate-1   

above console.log works as expected when the line is commented below data columns, I will call the data in column console.log i, brentSpiner.refreshRate dataColumn.remove i if brentSpiner.refreshRate -1, then the above errors Reference is: brentSpiner console.log (i, Brentspinrkfresseret); In the firebug

How to be undefined on Earth by the presence of a second line can be the variable in the above line?

Rendered JavaScript

failed

 for  (_i = 0, _len = allDataColumns.length; _i & Lt; _len; _i ++) {dataColumn = allDataColumns [_i]; For (i = _j = 0, _len1 = data column.Lambi; _j & lt; _len1; i = ++ _ j) {brent spinner = data column [i]; Console.log (i, brentspinner refresh rate); If (brentSpiner.refreshRate === -1) {dataColumn.remove (i); }}}   

Works

 for  (_i = 0, _len = allDataColumns.length; _i & lt; _len; _i ++) {dataColumn = AllDataColumns [_i]; For (i = _j = 0, _len1 = data column.Lambi; _j & lt; _len1; i = ++ _ j) {brent spinner = data column [i]; Console.log (i, brentspinner refresh rate); }}   

(Side note: Array has been added to the prototype via Removal)

UPDATE

This was a logic error in my part to see the accepted response to see why it is that what I was doing and worked well:

  data columns in all the data columns For i = 0 len = data columns. Length When I & lt; Len If Data Column [i] .refreshRate -1 is -1 Data Column. For Rally i Lane - i ++   

Rated

  = 0, _len = allDataColumns .length; _i & lt; _len; _i ++) {Data Column = All Data Columns [_i]; I = 0; Len = dataColumn.length; While (i & lt; len) {if (Data column [i] .refreshRate === -1] {dataColumn.remove (i); Len--; } I ++; }}    

Coffeescript "code" _len1 is the length of the list "freezing" . When you remove an entry, you will participate in the inner loop at the end of the list.

Looks like a bug for me (unless there is no language facility, by which you should inform the coffeeclass that the length of the array can change.)

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -