Lets say I have two arrays, with millions of objects in each. Before adding to one or the other I want to see which is smaller. Does .length go through each array counting each individual object and take forever or does it already know or perhaps get the index of the last object and add one?var arrayA = [millions of objects]; var arrayB = [millions of objects]; function doThing(variable){ var math = .......; var math2 = .......; if(arrayA.length < arrayB.length){ arrayA.push({data1:math , data2:math2 }); }else{ arrayB.push({data1:math , data2:math2}); }; return math; }; function blahBlah(blah){ blah blah blah; }; exports.doThing = doThing; exports blahBlah = blahBlah;
Submitted August 30, 2020 at 05:33AM by omato2468
No comments:
Post a Comment