Short question:
Let's say we have jQuery included. Will this function execute faster ...
var example1 = (function($, jQuery) {
return function() {
// do something
}
})()
... than the following one:
var example2 = (function() {
return function() {
// do something
}
})()
?
In the first one the jQuery object will be undefined
, in the second one it will be inherited. So the second one should be more expensive?
What is the best way to improve speed and get rid of inherited variables that decreases performance?
jsPerf test: http://jsperf.com/objinheritance