A common practice at this time is to connect a minified JS file to the end of the document before the closing body . They say that this is good for performance, but the question arises - how to initialize only those functions and variables that we need for the current web page?
With variables, in principle, I know several solutions, but I cannot say how best to initialize functions. Suppose the minified file includes the n-th number of functions, and when the minified file is loaded, all functions will be initialized, including those that are not needed on this particular page. And maybe a situation may arise when there are about 100 functions in a minified file, and only 2-3 are needed on a page.
Judging by the fact that this is not really trying to avoid, we can make the assumption that loading functions without calling them is not a very heavy operation in terms of performance, even if these functions are many. Is this a true assumption?