Reputation: 971
I was wondering about this because I am planning to load my JS file containing a lot of functions so I can efficiently call them whenever I needed them.
So I can efficiently not create a redundant function on the other page.
And I am wondering if the uncalled functions will increase the page's loading time.
Upvotes: 0
Views: 38
Reputation: 136
Well, if gathering those function into one JS file will help you more than the loading time frustrates you. Well that's good.
Even if the file size gets to 2MB, which will also have tens of thousands of code lines. You will not notice the slight loading difference if you have an average internet speed.
It's safe as long as you are not calling all the functions in every load. That will have a great difference.
Upvotes: 1
Reputation: 8378
They do add load time but it's not much if we're talking individual functions.
My question is why do you want to add functions you might use?
Upvotes: 0