Posts Tagged ‘comparisons’

Formatting an If Statement

Wednesday, January 30th, 2008

JavaScript does comparisons using == and === and does assignments using =. When you are coding your if statements you might accidentally leave out an = converting your comparison into an assignment. You might then have a great deal of difficulty in locating why your code is not behaving as expected. In this sixth tutorial on JavaScript decision making we look at how you can rearrange the condition tests in some instances so that the code will generate a syntax error when you make a simple typo when typing your comparison rather than having the code still run but producing the wrong results. This will make it easier to find where you made the error.

Formatting an If Statement

Comparison Operators

Tuesday, January 1st, 2008

Most of the time in making decisions you need to compare something with something else. The tutorials on how JavaScript makes decisions therefore begins with information on how JavaScript handles comparing two values.

Comparison Operators