Running code inside another thread in javascript
javascript(browser) is a single thread application, so even if you use a setTimeout at any point of time there will be only one thread running(doing script execution, ui repainting etc). Read more about how the timers work here
Since you have a script running in every millisecond it will freeze up the thread thus blocking the UI
Even though you have delegated execution via setTimeout
it will still be executed in the same single thread, it will just wait for its time in queue and will postpone any other activity until it's done.
Please refer to this awesome picture from "Secrets of JS Ninja" book:
Javascript is not multithreaded, you may want to look at Web Workers