Here we show that Javascript engine is single-threaded.
When you press on Button A, it will consume the processor for some time and then add a paragraph to the DOM. When you press on Button B, it will immediately add a paragraph to the DOM. To see that the JS engine is single-threaded, try to press button A, and shortly after press button B a couple of times. You should see that nothing happens for a while, and after that your button B clicks are processed. This shows the behaviour of event queue in Javascript - the browser is multi-threaded and can capture user events, but it places it to JS engine event queue, and the single-threaded JS engine processes those events one after another.