JavaScript JavaScript Loops, Arrays and Objects Simplify Repetitive Tasks with Loops Create a while Loop

Karly Lamm
Karly Lamm
Full Stack JavaScript Techdegree Student 3,753 Points

I keep getting a syntax error: parse error. I'm not sure what is wrong with my parameters.

I keep getting a parse error, so I googled what this meant and it said that something in my parameters is not being understood by JavaScript, but I am using a parameter we have been using in multiple examples, so I am not sure what it wrong with it.

function randomNumber(upper){
return Math.floor(Math.random()*upper)+1;

let count = 0;
while(count < 26){
let randomNum = randomNumber(26);

  count += 1;

2 Answers

Micah Hobbs
Micah Hobbs
Python Development Techdegree Student 13,066 Points

Hey Karly

The code runs without any errors in my browser console (prints out 26).

Is the error actually associated with this chunk of code? Which line in particular gives you the syntax error: parse error?

seth aruby
seth aruby
9,137 Points

Hey Karly, There is nothing really wrong with your code, meaning that technically it is syntactically correct. However you are missing a semicolon after your document.write statement. But the real problem is that this challenge doesn't appear to like it if you use let instead of var.