Use Web Worker API and enjoy Multi threading in Javascript. This is an example.