forEach array javascript incomplete -


updated

I try to create an array by calling a callback function and feeding it with values Other Areas However, I get only some values ​​and I can not understand why.

The structure is the same:

  var sorted Data = []; ArrayProvidingTheValues.forEach (pushEl, sortedData);   

and callback function

  function push EL (element, index) {console.log (called "pushle"); This [index] = element; }   

Input:

  cyiconer = {obj1, obj2 obj3, obj4, obj5, obj6}; ContratArray = {obj21, obj22 obj23, obj24, obj25, obj26}; Interval = 5   

Expected output

  sorted data = {obj1, obj2 obj3, obj4, obj5, obj6, obj21, obj22 obj23, obj24, Obj25, obj6, obj26};   

PS: This is the distracted code to show you in more detail.

 for  (var k = 0; k  gt; = saisineArray.length) {} and if ((Kashmir + 1) * Interval> = cycinarere.lamp) {cyiconare. Solis (K * interval, cycinarere lamps). ForEach (pushEl, sorted data); } Else {saisineArray.slice (k * interval, (k + 1) * interval). For each (pushEl, sorted data); } If (k * interval> = contratArray.length) {} and if ((K + 1) * interval> = contratArray.length) {contratArray.slice (k * interval, contratArray.length) .forEach ( PushEl, sortedData); } Else {contratArray.slice (k * interval, (k + 1) * interval) pre (pushEl, sorted data); }}    

instead of this [index] = element; this.push (element);

Now what you're doing is on the execution of each (pushEl) for sorted data the index index 0 Starts with

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -