Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 ALL


  The evolving history of asynchronous operation in JavaScript

JavaScript is single threaded, it means there would be only one task running at any point of time. But this would slow down the overall program execution if there is long running task, hence asynchronous task execution is desired in complex cases. To achieve asynchronous task execution, there are a few options introduced in JavaScript.setTimeout/setIntervalEventPromiseAsync/AwaitsetTimeout/setInterval is one of the first mechanisms introduced in JavaScript to simulate asynchronous operations. Since these operations are not executing in sequence, there would be a potential issue on how data/sta...

5,841 0       AWAIT JAVASCRIPT ASYNC PROMISE


  Load and execute JavaScript

When we load and execute JavaScript in a webpage, there are many points we need to care about because of its design and feature. There are two features about JavaScript execution in a browser: 1). The JavaScript codes will be executed immediately once loaded;2). When JavaScript codes are being executed, they will block the following contents (including page rendering and other resources downloading). So if there are multiple js files to be loaded, these codes will be executed sequentially.Since JavaScript codes may operate HTML DOM tree, browsers generally will not download js files in paralle...

9,287 0       JAVASCRIPT LOAD ASYNC DEFER EXECUTE