JavaScript - slow motion ?

I’m making an FPS where you can enter slow motion and get out of it by pressing a single button, but I’m not sure of what to write inside the script. If anyone could help I would greatly appreciate it