4 ms·
For those wondering: setDisplayMessage() { switch(true) { case(this.difference <=1000): return 'Looks like you basically have no idea how long 5.5 se
by mrb 4y ago
For those wondering:
setDisplayMessage() {
switch(true) {
case(this.difference <=1000):
return 'Looks like you basically have no idea how long 5.5 seconds is.';
case(this.difference <=2000):
return 'I mean, you can do better. :D';
case(this.difference <=3000):
return 'You are getting the hang of it. Sort of.';
case(this.difference <=4000):
return 'As they say, it could have been worse.';
case(this.difference <=5000):
return 'Super close!';
case(this.difference <=5250):
return 'DOH! You almost had it.';
case(this.difference <=5375):
return 'Great score!!!';
case(this.difference <=5499):
return 'NICE!!!';
case(this.difference <=5500):
return 'YOU DID IT YOU DID IT YOU DID IT YOU DID IT I CAN\'T BELIEVE IT!!!!!';
default:
return 'Aaand just like that, you went over.';
}
- colejohnson66 4y agoThat’s an… interesting usage of a switch block…
- smegsicle 4y agoelif is for suckers, but a COND by any other name...
- Minor49er 4y agosetDisplayMessage() { if (this.difference <= 1000) return 'Looks like you basically have no idea how long 5.5 seconds is.'; if (this.difference <= 2000) return 'I mean, you can do better. :D'; if (this.difference <= 3000) return 'You are getting the hang of it. Sort of.'; if (this.difference <= 4000) return 'As they say, it could have been worse.'; if (this.difference <= 5000) return 'Super close!'; if (this.difference <= 5250) return 'DOH! You almost had it.'; if (this.difference <= 5375) return 'Great score!!!'; if (this.difference <= 5499) return 'NICE!!!'; if (this.difference <= 5500) return 'YOU DID IT YOU DID IT YOU DID IT YOU DID IT I CAN\'T BELIEVE IT!!!!!'; return 'Aaand just like that, you went over.'; } elif is for suckers indeed