Working with array of CSS classes in JavaScript

Given an element:

<p id="elem" class="www ggg zzz"></p>

Find out the number of its classes.

Given an element:

<p id="elem" class="www ggg zzz"></p>

Loop through its classes.

enru