// Task 1
(function() {
var link = $('a');
var div = $('div');
// use this link and div which has scope only here
})();
// Task 2
(function() {
var link = $('a');
var div = $('div');
// use this link and div which has scope only here
})();
Both are same variable but they will not affect each other.