Ask coding questions

← Back to all posts
need help please
washingtonwill (0)

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.

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

Commentshotnewtop
Vandesm14 (744)

What do you need help with? What specifically? We can't do your homework for you but we can help you with specific problems/issues.

washingtonwill (0)

I'm having trouble re-assigning the greaterThanFive boolean true. when I change it to return true its still incorrect cant figure out what im doing wrong.
@Vandesm14

washingtonwill (0)

the if statement part would be
if(greaterThanFive>5) then id have to change the false to return true [email protected]

Vandesm14 (744)

@washingtonwill Did you write any code? All I have is the initial assignment. If you haven't written any code yet, try it first then send me your code.

Pro Tip: You can format your code in a post/comment like so


Looks like:

console.log('Hello');
washingtonwill (0)

greaterThanFive = value>5;
if(value>5){
//run this code if expression is true
console.log("true");}
@Vandesm14

Vandesm14 (744)

@washingtonwill You're doing good. Now just reassign the variable (same as assigning it)
If you need 1on1 help, I've invited you to a multiplayer session. (you can find it here: https://repl.it/repls/multiplayer)

washingtonwill (0)

this is what i'm getting but says its incorrect.

function exerciseFour(value){
let greaterThanFive = true;
// 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.
value = greaterThanFive;
if(greaterThanfive>5)

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