Ask coding questions

← Back to all posts
Something's wrong with my function.
h
cuber1515 (91)

Error with a function

So I'm making a small website for practicing JavaScript, it's just a bunch of window history stuff.

The problem is that whenever I add that last variable (it's in the script.js file) the repl just gives up even trying to run.

Help please

Comments
hotnewtop
Coder100 (18917)

You forgot to define i so it became a global variable.

Here is the correct code for line 12

for (let i = 0; i = 5; i ++)
cuber1515 (91)

@Coder100 Thanks, I didn't realize that, but it still doesn't work.

Coder100 (18917)

you never defined printHistLinks, you commented out the variable! line 17 @cuber1515

cuber1515 (91)

@Coder100 yes, but when it's not commented is when it doesn't run. I just have it commented so that I can run it to test other things.

Coder100 (18917)

well uncomment it so we can fix it??? @cuber1515