r/code • • Mar 14 '24

My Own Code uncaught SyntaxError

were making a lovers game when the girl puts her name and then her boyfriend and gets a number % back . i keep geting a uncaught SyntaxError: Unexpected token '{' on line 7

  1. prompt('what is your name ');
  2. prompt("what is your lover's name");
  3. var loveS = Math.floor(Math.random() * 100)+1;
  4. prompt('your love score is '+ loveS +'%');
  5. if(loveS < 50){
  6. prompt('not looking good');
  7. }elseif(loveS > 51 && loveS < 75){
  8. prompt('good but needs work');
  9. }else(loveS>75){
  10. prompt('match made in heaven');
  11. }

would wrapping it in a try block and console.loging the error help

2 Upvotes

6 comments sorted by

View all comments

Show parent comment

1

u/angryrancor Boss Mar 16 '24

Sorry, probably came off as a little harsh, there. I should of made a more gentle suggestion to be sure to read relevant material in the lesson, apologies.