click on Page settings and select Add Scripts to add your code there;
another way is to add an HTML widget to the page and add your code there. It should be wrapped by <script> tag.
e.g. You want your customers to see current date as a pop-up notification while opening your page, so you use this code:
let d = new Date();
alert("Today's date is " + d);
This is how it will look:
That's it! One last thing - JS effects will be shown on a published page only, it can't be seen in the editor itself.