简体   繁体   中英

JavaScript asynchronous programming

Recently, I began studying JavaScript, and I reached a topic about asynchronous coding, or some refer to it as function parameter or callback (node.js to be more specific).

I tested some stuff with it, but can`t get the idea of it. For example

window.addEventListener("click", function(){ alert("HELO"); }, true);

will do nothing. Can somebody explain in short what exactly is the idea behind asynchronous coding and what are these callbacks, also a 3-4 line example will be appreciated.

The code you have written requires the window object which is not a part of the node.js environment.

I recommend watching ryan dahl's introduction to node.js

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM