I'm fairly new to JQuery. I've written the following function, I can view the created array in the console so I know that the function works okay. My question is how do use the array outside of the function? I've tried inserting return arr; at the end of the function, but I just can't seem to access the array values!
function css_ts() {
arr = [];
$('.timeslot').each(function(){
var bid = $(this).children("input[type='hidden']").val();
if (bid > 0) {
$(this).css('background-color','blue');
arr.push(bid);
}
else
{
$(this).css('background-color','#ececec');
}
});
console.log($.unique(arr));
}