I know there has to be a better way than this:
if (mon_open_close_hours=='12:00-12:00'){
mon_open_close_hours='24hrs';
}
if (tue_open_close_hours=='12:00-12:00'){
tue_open_close_hours='24hrs';
}
if (wed_open_close_hours=='12:00-12:00'){
wed_open_close_hours='24hrs';
}
if (thu_open_close_hours=='12:00-12:00'){
thu_open_close_hours='24hrs';
}
if (fri_open_close_hours=='12:00-12:00'){
fri_open_close_hours='24hrs';
}
if (sat_open_close_hours=='12:00-12:00'){
sat_open_close_hours=['24hrs'];
}
if (sun_open_close_hours=='12:00-12:00'){
sun_open_close_hours=['24hrs'];
}
Is there a way to condense this somehow?
I've tried this, but it returns '12:00-12:00' for everything
var $variables = [mon_open_close_hours,tue_open_close_hours,wed_open_close_hours,thu_open_close_hours,fri_open_close_hours,sat_open_close_hours,sun_open_close_hours];
$variables.map(function(val) {
if(val=='12:00-12:00'){
val=['24hrs'];
}
})
Aucun commentaire:
Enregistrer un commentaire