foo#bar. Basically, the hash (
#) stands for
.prototype. — fancy huh?
Let’s see an example:
var numbers = [1, 2, 3]; // array literal
numbers.push(42); // `numbers` is now `[1, 2, 3, 42]`
Array.prototype.push method is called. You could also say
Array#push is called.
A note about jQuery
For convenience, jQuery aliases
jQuery.fn. Don’t let this fool you! Whenever you use e.g.
jQuery(elem).remove() you’re still calling
jQuery.prototype.remove (to which
jQuery.fn.remove is a reference), or — using the short notation —
jQuery(elems).map(fn); // jQuery#map, which is jQuery.prototype.map (or jQuery.fn.map)
jQuery.map(arr, fn); // jQuery.map
Similarly, when using a jQuery plugin that extends
jQuery.fn, you’re really extending
jQuery.prototype. I’ve been using the short notation when talking about jQuery plugins, e.g.
In the spec world, sometimes the
Foo#bar notation is used to refer to the
bar IDL attribute of
Foo rather than