N341 JQuery

How JavaScript's weak typing can lead to errors

JavaScript can convert data types behind the scene to complete an operation. This can come in handy for those times when it is nice for the computer to use a little common sense. However, it can also lead to errors. For each JavaScript example below, try to guess what the result will be. Then, click the button to learn what really happens. See pages 166 - 168 of the text for more information.

html

css

Example 1   Example 2   Example 3
JavaScript