Forgive me if this question has been asked before.
I am very new to JavaScript and I was reading the following blog post: http://www.dustindiaz.com/javascript-no-no/
The first point he makes is to move document.getElementByID() calls into a getter. This makes sense to me as it makes the code more modular and convenient in general. However, he then says:
Most will even prefer the classic Prototype $ function that allows you to pass in an arbitrary number of arguments. That works well too.
$('foo', 'bar', 'baz');
I have not been able to find documentation on this method though, am I reading it right that this is equivalent to calling document.getElementById()
, except that you can have multiple arguments with the prototype?
If so, what are the advantages to using document.getElementbyId('foo')
over $('foo')?
Edit: I just realized that he capitalized the P in "Prototype". Is Prototype some sort of external framework? I was under the impresstion that it was just like a shortcut or something.