r/javascript • • Mar 09 '15

Things every JavaScript developer should know

http://ilikekillnerds.com/2015/03/things-every-javascript-developer-should-know/
326 Upvotes

118 comments sorted by

View all comments

28

u/cgaudreau senior HTML9 engineer Mar 09 '15 edited Mar 09 '15

Good article. However, correct me if I'm wrong, but the provided FizzBuzz implementation appears to be incorrect. On multiples of 15, the provided solution would print "FizzBuzz Fizz Buzz".

EDIT: the author fixed it after I posted. The original example had no elses or else ifs.

2

u/ike_the_strangetamer Mar 09 '15

the example uses a chain of 'else if' and 'else' after the first conditional, so those won't be evaluated if the first condition is true.

3

u/cgaudreau senior HTML9 engineer Mar 09 '15

Indeed. Looks like the author fixed it. It originally used ifs exclusively.

2

u/[deleted] Mar 09 '15

It was changed