Re: How to create anl infinite loop in JavaScript - Beginner Tip
By the way, your example doesn't test the value of the variable ten; it tests whether the variable [c]ten[c] can be assigned a value of 1. That's why this construct:
Code:
if (variable == 1) {...}
is strongly discouraged in favour of the Yoda version:
Code:
if (1 == variable) {...}
When you accidentally use the assignment operator (=) instead of the equivalency test (==) or the equality/identity test (===), you get an error (a compiler error in a compiled language or a runtime error in an interpreted language) because you can't assign a value to a literal.
“Beware of bugs in the above code; I have only proved it correct, not tried it.” --Donald Knuth
"It was as if its architects were given a perfectly good hammer and gleefully replied, 'neat! With this hammer, we can build a tool that can pound in nails.'" -- Alex Papadimoulis (on TheDailyWTF.com)