When I run the code below:
var divs = $('div');
// The first three methods of showing a div work
divs.eq(0).show();
(divs.eq(1).show)();
var f = function() {
divs.eq(2).show();
}
f();
// But this doesn't. Why?
var g = divs.eq(3).show;
g();
The last method doesn't show the div, and there's no error in the console. I want to use it because I want to store the function concisely without creating an anonymous function block. This is what I would normally do in Python. I can't understand what goes wrong here.
EDIT: the comments aren't really helping me understand the problem. How did this
get lost? What did it change to and why? Why doesn't that happen with (divs.eq(1).show)();
?