I'm practicing conditional logic within certain JQuery functions. $('h2').css({backgroundColor: 'red'}); works, but when I add the conditional logic below it no longer works. If I change the return value to a string it will get rid of the error, but it still doesn't change the background color. What am I doing wrong?
$('h2').css({function(){
if (1 === 1){
return backgroundColor: 'red';
}
else {
return backgroundColor: 'purple';
}
}});