Skip to content
← Back to Community
Something's wrong with my function.
Profile icon
cuber1515

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
Profile icon
Coder100

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 ++)
Profile icon
cuber1515

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

Profile icon
Coder100

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

Profile icon
cuber1515

@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.

Profile icon
Coder100

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

Profile icon
cuber1515