If you set the worker variable to undefined, after it has been terminated, you can reuse the code:
w = undefined;
Read Articlehttps://develop.horje.com/learn/1434/reference