Javascript is single threaded. What I understand from this is if JS i executing on line of code lets say a function. It cannot go to the next line unless that function has been removed from the stack.
With that being said, I do not understand, how promises let us execute other code blocks down the road, while the interpreter is still resolving the promise code.
I am a noob in JS so I am trying to understand the underlying implementation.
I saw an example PHP implementation of Promises and the idea is that PHP can fork a separate process in a different thread that sends back signal to the main thread when the async code has been executed.
Does it work the same way in Javascript ?
Thanks