The simplest solution is to use pop, which accesses the last element in the array.
var lastClass = $('div').attr('class').split(' ').pop();
Note that pop also removes the element from the array, but since you aren't doing anything else with it, that's not a problem.