I was wondering if there is a good link on how to better format .js files?
Do you treat them like a class of files, or do you separate the functionality from the page that it processes? Are you creating .js functions that can be used on multiple pages, or are you writing a custom .js file for each page?
I'm just wondering if there is a formal way, and not just write a bunch of functions that may or may not be combined together for a specific page or set of pages. Right now I'm trying to group by page functionality, but my .js files are very customizable for this page, not sure if they can be used on another page.
:: UPDATE ::
Some of the answers have the same topic and mainly about what you plan to do with the project. Now the project is completely new for me, and the requirements are slow. Therefore, I build it on the pages. There may be cross functionalities or similar functions in the future. Most of the functionality is very specific to a particular page.
Is it wise to group AJAX calls into .js, but also have a custom .js page that contains all the highly customizable page functions.
source
share