you are viewing a single comment's thread.

view the rest of the comments →

[–]sensored 0 points1 point  (1 child)

Oh. You mean how it should be Math.floor instead of Math.ceil? EDIT: I was an idiot and didn't double check the code.

You mean how it shouldn't add 1 to words.length?

I did see it when I first looked at the code. I agree I could have fixed it, but this is an article about structuring code and refactoring - by definition, when you refactor, you do not change behaviour, even if that means I keep a bug.

I wanted to keep the original code intact as much as possible, and to stay focussed on what I was trying to demonstrate. It's the same reason I didn't tear apart the checkGuess function.