Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Timed 2 in JS (issue with for loops)


thehare's Avatar
Member
0 0

Hey guys, just trying my hand at the timed challenges using JS (via greasemonkey). I was never very proficient at JS so I thought what better way to learn it than doing some of these challenges -and thankfully there's even an entire article here written on the subject.

Well it seems I overlooked one part in my code, and that is I cant pull any variable values from my 'for' loops after they are completed (kind of forgot about that as I was figuring out the code lol).

Was just wondering if I could show someone what I have so they could nudge me in the right direction


Futility's Avatar
:(
80 122

Not a master JSer, but I can take a look.

Off the top of my head, it sounds like you've got some scoping issues. Try declaring the variables outside the loop and ( re )setting them as necessary while inside. That always seems to work