News for hackers. Stuff that matters.
Re:Can (a ==1 && a== 2 && a==3) ever evaluate to true? by DougN7 on Tuesday January 16, 2018 @03:40PM (#16162286)
I'm not familiar with threads in javascript, but the expression could be true (though mighty hard to bring it about) in many multi-threaded languages.
Re:Can (a ==1 && a== 2 && a==3) ever evaluate to true? by jdmichal on Tuesday January 16, 2018 @06:07PM (#16163700)
JavaScript is a single-threaded execution environment with an event pump. When people talk about asynchronous actions like in Node.JS, they really mean doing non-JavaScript things in another thread and waiting for an event to arrive back. For example, load this file, and put an event on the queue when it's completed loading so that I can process it. In this way, you can queue multiple files to be loaded at once, even though only one can be processed by the JavaScript code at one time. This generally works out OK, because many systems are effectively IO bound and not processing bound.