If you're just getting into JavaScript, you might start getting fancy with your "Conditional Branches" and start using scripting instead of just the default values. When you do, it's really important to remember that "=" is the assignment operator, while "==" is the equality operator. "==" asks if two things are equal, while "=" overwrites the value on the assigned on the left with whatever value is on the right.
As an example, here's what took me literally hours to figure out this evening, because I forgot this simple fact.
This is bad. It forces the length of variable 312 (which is an array, though that's not really important) to become 0. It's bad for 2 reasons.
1. This isn't a question, so there isn't a chance for it to evaluate as true, which means that anything inside the if statement is never going to be done. In this case, that means an infinite loop, which is always just fantastic.
2. It overwrites whatever was in variable 312 with 0. In this case, since it's setting the length of variable 312 to zero, it's actually setting the value of 312 to [ ], removing all contents and making a mess of my evening that took hours of debugging and me being an idiot to sort out.
Here's what it was supposed to be
Now, it's actually checking the condition properly, and not overwriting the information with whatever garbage I accidentally turned it into.
Don't be like me kids. Always remember that "=" and "==" are different.
As an example, here's what took me literally hours to figure out this evening, because I forgot this simple fact.
This is bad. It forces the length of variable 312 (which is an array, though that's not really important) to become 0. It's bad for 2 reasons.
1. This isn't a question, so there isn't a chance for it to evaluate as true, which means that anything inside the if statement is never going to be done. In this case, that means an infinite loop, which is always just fantastic.
2. It overwrites whatever was in variable 312 with 0. In this case, since it's setting the length of variable 312 to zero, it's actually setting the value of 312 to [ ], removing all contents and making a mess of my evening that took hours of debugging and me being an idiot to sort out.
Here's what it was supposed to be
Now, it's actually checking the condition properly, and not overwriting the information with whatever garbage I accidentally turned it into.
Don't be like me kids. Always remember that "=" and "==" are different.