Is it possible to create a 'wait until loop' and keep other code running at the same time as this loop in JavaScript? I know that while loops don't work.
Your question isn't very clear. However, from what I understand, you are talking about asynchronous tasks. Please check the mdn documentation for setTimer() and setInterval().