how to access the second class of an element javascript

JavaScript
var classes = $('#divID').attr('class').split(' ');

for(var i=0; i<classes.length; i++){
  alert(classes[i]);
}alert($('#divID').attr('class').split(' ')[1]);
Source

Also in JavaScript: