Conditionals Test Q- nested switch statement in if..else

Can anyone shed some light on why this code isn’t working?

Whenever it runs, it just picks up the default switch response, rather than the responses logged to the specific score. Have I written something out wrong in the syntax?

Any help would be appreciated. Thank you!

let response;
let score = 19;
let machineActive = true;

if(machineActive) {
switch(score) {
case (score < 20):
response = ‘That was a terrible score - total fail!’;
break;
case (score >=20 || score <40):
response = ‘You know some things, but it’s a pretty bad score. Needs improvement.’;
break;
case (score >=40 || score <70):
response = ‘You did a passable job, not bad!’;
break;
case (score >=70 || score <90):
response =‘That’s a great score, you really know your stuff.’;
break;
case (score >=90 || score <=100):
response=‘What an amazing score! Did you cheat? Are you for real?’;
break;
default:
response = ‘This is not possible, an error has occurred’
}
} else {
response = ‘The machine is turned off. Turn it on to process your score.’;
}

// Don’t edit the code below here!

section.innerHTML = ’ ';
let para1 = document.createElement(‘p’);
let para2 = document.createElement(‘p’);

para1.textContent = Your score is ${ score }.;
para2.textContent = response;

section.appendChild(para1);
section.appendChild(para2);

Hello @wilford.amy

the trick that you use true instead for the switch instead of score

it would be better to have link to the page you asking about to be easier for everyone to get to it

and have a nice day :slight_smile: