In the first one (self executing function), the process of function execute just once, so:
APP._getScriptLocation();
APP._getScriptLocation();
APP._getScriptLocation();
is just returning the l
for each call (the process will never execute again - it's just execute once your script loaded: because it was a self executing function).
But in the second one, whenever you call your method:
APP._getScriptLocation();
You are executing all the process again and again which is not needed in this case.