You can see a comparison between querySelectorAll and getElementsByClassName below:
Length of list returned by getElementsByClassName('code'):
Length of list returned by querySelectorAll('.code'):
(Live nodeLists update dynamically; just click 'Insert' from the control bar)

This is a sample element of class 'code'.
getElementsByClassName is an HTML5 API that you can use to easily grab elements that belong to a certain class. You can call it on a document to get all elements that match, as well as on individual elements to search their subtrees.
It returns a live nodeList, which is useful in certain cases. If you need a static list, however, you can always call querySelectorAll with the ".className" syntax.
Example 1:
document.getElementsByClassName('example code');
This searches the entire document for an order-insensitive match on classnames 'example' and 'code'.
Example 2: querySelectorAll vs. getElementsByClassName
var list = document.getElementsByClassName('code');
getElementsByClassName returns a live nodeList, so the 'list' variable above will always contain an up-to-date list of elements that match the string parameter. To see an example in action, compare querySelectorAll, which returns a static list, to the results of getElementsByClassName, by looking at the list length comparisons below the command bar.