Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

Share this Page URL

Hour 3. What Node.js Is Used For > Humans Are Unpredictable - Pg. 35

Humans Are Unpredictable 35 3. Watch the responses coming back from the servers. 4. Run it again from the terminal: node app.js 5. Examine the output and compare the response times. This simple example demonstrates that, in relation to time, network-based I/O is not predictable. Humans Are Unpredictable If you have developed any JavaScript for the browser, you understand that if you are writing code that humans are going to use to interact with a web page, you use a different style of pro- gramming. It is impossible to say the order or time that humans will perform certain actions. Here is some JavaScript code to show an alert to a user when she clicks a link with an id of "target:" var target = document.getElementById("target"); target.onclick = function(){