When to 'while' and when to 'for' Problem (Please Help)


#1

https://www.codecademy.com/courses/javascript-beginner-en-ASGIv/2/1?curriculum_id=506324b3a7dffd00020bf661#

I keep getting the message "rollDice is not a function." Is there something wrong with my syntax? I keep checking but I can't seem to find it.

`


var rollDice = [1,2,3,4,5,6];
var rollDice = true;
while (rollDice) {
console.log("Lets the roll the dice!!");
rollDice = false;
}
for (var i = 1; i < 7; i++) {
console.log(i);
}
rollDice();


#2

The error is due to this. This is a function syntax when rollDice is not a function.


#3

Yeah, I fixed that part, but should I only be getting 1 number instead of all six?


#4

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