Ask coding questions

← Back to all posts
Lambda Pre Course JS 3.
tcrosby (0)

I have been trying to figure out what is going on with my answer for the last two exercises. The "hints" keep saying "Missing ';' before statement".
PLEASE HELP. I have put a semi-colon in-between every single character in my answer and it is still wrong!

  1. function exerciseFour(value){
    let greaterThanFive = false;
    // In this exercise, you will be given a variable, it will be called: value
    // You will also be given a variable named: greaterThanFive
    // Using an 'if' statement check to see if the value is greater than 5. If it is, re-assign greaterThanFive the boolean true.

    if (value > 5){return greaterThanFive true;} //my answer//

    // Please write your answer in the line above.
    } return greaterThanFive;

  1. function exerciseFive(name){
    let isSondra = false;
    // In this exercise, you will be given a variable, it will be called: name
    // You will also be given a variable named: isSondra
    // Using an 'if' statement check to see if the name is equal to the string 'Sondra'. If it is, re-assign isSondra the boolean true.

    if(name === "Sondra"){return isSondra true;} //my answer//

    // Please write your answer in the line above.
    return isSondra;
    }

Answered by ash15khng (393) [earned 5 cycles]
View Answer
Commentshotnewtop
ash15khng (393)

You should be reassigning the variables in the if statements not returning them. Do greaterThanFive = true in the if statement then return it outside the statement.

tcrosby (0)

Thank you. I actually did that originally and it said i was wrong so I tried it this way. But now it is accepting it. Thank you [email protected]

ash15khng (393)

@tcrosby No problem! Could you mark my answer as correct? Thanks!