Hello,
Thank you for posting in Microsoft Q&A.
Based on the description, I understand your question is related to notepad.
Go to Settings > Apps > Default apps.
Scroll down and click on Choose default apps by file type.
Find the .js file type in the list.
Change the default app to a different program (e.g., a text editor other than Notepad or a custom script that does nothing).
You can also block the execution of JavaScript files using Attack Surface Reduction (ASR) rules in Microsoft Defender
Have a nice day.
Best Regards,
Molly
============================================
If the Answer is helpful, please click "Accept Answer" and upvote it