how to check if jQuery .each() function cant find something, then change txt value to 'default'.
$(this).closest('.filter-select__dropdown-inner').find('> .button--checkbox.button--active').each(function(i) {
var val = $(this).val();
if (i == 0) {
txt = val;
} else {
txt = txt + ', ' + val;
}
});
im already try
if (i == null) {
txt = 'default';
}
but it doesnt work