I have a page where almost all functions were using Ajax request. I have so many lines of js code. Is it a good practice to dissect my js codes and just include it in my page, for example:
<script src="../js_code_func_1.js"></script>
<script src="../js_code_func_2.js"></script>
<script src="../js_code_func_3.js"></script>
<script src="../js_code_func_4.js"></script>
<script src="../js_code_func_5.js"></script>
Will there be any bad performance effect if I do this?
Thanks! From a JavaScript noob..
There are 2 different perspectives:
From the development perspective – each file should contain only the small particular part of functionality (some limited and complete application unit)
From the UX perspective – the less files – the better (because the more HTTP request you have – the longer user will wait until the page is rendered)
So the common solution is to split your application to as much files as best design practices require and join+minify them before deploy