JavaScript: Difference between revisions

add more
add more
add more
Line 1: Line 1:
=== examples ===
=== examples ===


things to watch out for in automatic type conversion.
Things to watch out for in automatic type conversion.


<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
Line 10: Line 10:


NaN == NaN; // false  use isNaN() function instead
NaN == NaN; // false  use isNaN() function instead
Number("5") * 5; // explicitly convert "5" to number and perform operation
</syntaxhighlight>
</syntaxhighlight>


Line 15: Line 17:
</syntaxhighlight>
</syntaxhighlight>


automatic type conversion. To disallow automatic type conversion, use === or !== operators.
Automatic type conversion. To disallow automatic type conversion, use === or !== operators.


<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">