N
N
nekiystranger2019-09-14 20:53:31
JavaScript
nekiystranger, 2019-09-14 20:53:31

What is the timing of a while loop in JavaScript?

I started learning programming in JS, it became interesting how often the interpreter executes the script, at what speed, I created this code: I launched it in Chrome, I see that the icon on the tab is always rotating, the question arose, what is responsible for this, the V8 browser engine? How fast does it run the loop over and over again, with what frequency in milliseconds? PS The processor is almost not loaded at this moment
while(true);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2019-09-14
@nekiystranger

JS is a single threaded (almost) language. So your loop just spins as fast as possible, blocking the execution of other scripts on the page, including those triggered by an event. There is no fixed execution speed in JS.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question