If you declare a variable outside each , it will be available inside each :
var yourArray = []; $('.profile-nav ul li a').not('.apply').each(function() { if($(this).hasClass('cur')) { yourArray.push($(this).prop('class').split(' ')[0]); } });
Although, as others have shown, there are ways to significantly reduce your code.
James allardice
source share