Have been stuck in Lesson 4 for hours and still have no idea what I'm doing


#1


The problem is I've gone as far as establishing Math.random() as a var, and from there I have no clue how to go on about things. I've been stuck here for couple hours now and feels like my brain today can't process anything. Maybe I've hit my limit, Idk I feel like an idiot



Replace this line with your code.


#2

What are you currently trying to make happen?
And how would you do that manually?
Is there anything stopping you from describing those same actions in code?


#3

Don't be distracted by the term "between". It is misleading. Given a number less than 1, divide it into three intervals, and starting with the lowest one, elliminate it, then the next and finally else the third.

if (___ <= 0.33) {

}
else if (___ < 0.67) {

} else {

}

#4

Awesome thank you, I guess we were making it harder than it had to be with that "between".


#5

Also a note to others I was using "return" but wasn't working. console.log worked.

So questions to those who know more, what would return do? Was it wrong because thats not the "answer" or "code" they wanted? Or return is just completely wrong?


#6

return may only be written inside a function body. An if statement is not a function, though it may be written into a function, at which point return would be valid. For this project, just write the code asked for, namely, the if..else if..else statement that assigns a new string value to computerChoice.


#7

Ah ok, thank you very much!


#8

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.