You are presenting two problems it seems.
1) a problem with some javascript program.
2) a slow machine.
Lets deal with the slow machine.
I'd run etrecheck. Etrecheck will analyze your
machine and software and generate a report. Post results here so
others can view. Experienced users have found the reported
information useful when diagnosing problems. The proprietary stuff
in the report gets filtered.
Install and run
-- Download etrecheck. Goto the EtreCheck download page.
The download link is at the bottom of the screen
-- Install etrecheck. Goto your download folder. Double click on
EtreCheckPro.zip
-- Drag the app to the application folder if you wish.
-- Turn on full disk access for EtreCheck. This was how
macos used to work. Do it for etrecheck not avast as in the
instructions.
https://support.avast.com/en-us/article/Mac-full-disk-access
-- Double click on etrecheck to run. The first five
runs are free.
An alternative explanation how to install, run and report output
for the EtreCheck Application
Using
EtreCheck to Troubleshoot Potential… - Apple Community
Explanation of EtreCheck output by etresoft, the author.
Using
EtreCheck - Apple Community
How to report etrecheck data.
When the report is done, click on the export icon.

click on "Copy report" to copy to the clipboard

Get back in your web browser and access your discussion. Create a
new reply. Click on the <> code icon. Paste you etrecheck
output into the code block.
which results in...

Robert
PS. You may find Old Toad's write up helpful.
https://discussions.apple.com/docs/DOC-250000211
--------------------------- the above in html --------------------------------------------