javascript - Order of execution for console statements for different browsers -
I tested the following code in both Firefox (32) and Chrome (38)
var starttime = (new date ()). GetTime (); Console.log (STARTTIME); Var data = []; Var tCat = "ABCDEFGHIJkLMNOPQRTUVX". Split (""); Var datapoint = 2000000; (Var i = 0; i & lt; data points; i ++) for {var r = Math.random; Data.push ({value: Math.pow (1 - Math.cos ((r ()) * Math.PI) / 2), 3), Cost: + r (). ToFixed (2), Category: tCat [Math .floor (r () * tCat.length)]}); } Var endime = (new date ()). GetTime (); Console.log (ENDTIME); Console.log (end time - starttime);You can view it on
In Firefox, it seems that all three consoles are fire at the same time, after Loop over execution, but the first console statement in Chrome is shown that the loop execution starts. This code works by itself, but execution deviation of the first console statement in Firefox is deviation. Can anyone explain this?
TL; DR: Console is not controlled by any standard and depends on browser.
It works as expected Try adding a breakpoint and step through each line in the code, and you will see that they execute as expected one more Raw view your script to
alerts ()
. Makes paralyze withHowever, the behavior is still vendor-dependent. no guarantee.