I'm working on a dashboard for a website where you have two JS functions at the bottom of the page that will only be used on a page that will be opened in a modal.
On this site there is also a file dedicated only to scripts.
I would like to know if there are any problems I put these two functions only on this page because I will only use these functions in it, or I have to ALWAYS put in the .js file regardless if I will only use one page.
I'm wondering why I always put all the JS in this file, however, I KNOW (I do not know if it's the right one) that there's no need to be polluting more and more a file by putting a function that I'll only use on a page in the entire site.
What is the ideal way?