You would have to declare the variable outside the function scope, otherwise the variable will be private to the anonymous function.
var checkBoxClasses;
$(currentMap).find(':checkbox').filter(':checked').each(function () {
var b = $(this).attr('class').split(' ');
checkBoxClasses = b[0];
});
alert(checkBoxClasses);
However, as you are looping over the checkboxes, only the last checkbox will be alert, if you do it this way. If you like to do an alert for every checkbox, you would have to move the alert into the loop as well. Or, if you would like to alert all the checkboxes in a single alert, you could use either an array, or extend the string with each new checkbox, instead of replacing it entirely.