In order to debug the Discord JavaScript error, you have to close Discord fully. After that, press Win + R, input %appdata%, and remove the Discord folder. Return to %localappdata%, and delete the Discord folder there too. Next, reboot your computer and get the most recent version of Discord from the official website and install it.