I've recently run into a rather nasty bug, wherein the code was loading a <select> dynamically via JavaScript.  This dynamically loaded <select> had a pre-selected value.  In IE6, we already had code to fix the selected <option&g...
I've just finished reading the Promises/A+ specification and stumbled upon the terms microtask and macrotask: see http://promisesaplus.com/#notes  I've never heard of these terms before, and now I'm curious what the difference could be?...
I am thinking about it and this is what I came up with:  Let's say we have a code like this:  console.clear(); console.log("a"); setTimeout(function(){console.log("b");},1000); console.log("c"); setTimeout(function(){con...
The following figure is taken from Chapter 3 of the book Secrets of the JavaScript Ninja by Jon Resig. Here the author is explaining the browser event loop.    The book has to say this :     It’s important to note that the browser mechanism that pu...
I've recently seen a presentation on the JS event loop which is, frankly, brilliant, but I have a lingering question now about the JS call stack. If you think about the global execution context as, say, main(), is main() never resolved? My reason...
Hey hava googled and tried every thing - but nothing seems to work, so now i will ask you guys:  How do i make my Node app. from stop exiting - when i like it to keep running and wait for response from a Web Socket connection? As you can see i have t...
So, I've been thinking about a brain teaser - what if I had a large object I for some reason had to iterate through in node js, and didn't want to block the event loop while I was doing that?  Here's an off-the-top-of-my-head example, I&#...
I've been introduced to the concepts of Microtasks and Macrotasks for a while now, and from everything I've read, I always thought setTimeout to be considered to create a macrotask and Promise.resolve() (or process.nextTick on NodeJS) to crea...
It's better to write code that doesn't rely on the timing of immediate callbacks (like microtasks vs macrotasks), but let's put that aside for the moment.  setTimeout queues a macrotask, which, at a minimum, waits to start until all micro...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.