Simple delay

Hello. I have a problem :worried: , I want to use setInterval to replace the bad line:

for (k=0;k<10000;k++){}

I looked for an example or something which could help me, but I don’t understand how to use setInterval and clearInterval. Thanks for any idea