Type-conversion adheres to the following rules : Type Conversion « Number Data Type « JavaScript Tutorial

JavaScript Tutorial
1. Language Basics
2. Operators
3. Statement
4. Development
5. Number Data Type
6. String
7. Function
8. Global
9. Math
10. Form
11. Array
12. Date
13. Dialogs
14. Document
15. Event
16. Location
17. Navigator
18. Screen
19. Window
20. History
21. HTML Tags
22. Style
23. DOM Node
24. Drag Drop
25. Object Oriented
26. Regular Expressions
27. XML
28. GUI Components
29. Dojo toolkit
30. jQuery
31. Animation
32. MS JScript
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
JavaScript Tutorial » Number Data Type » Type Conversion 
5. 8. 2. Type-conversion adheres to the following rules

true is converted to the number 1 before being compared.

false is converted to 0 before being compared.

If either of the operands are NaN, the equality operator returns false.

null and undefined are equal.

null and undefined are not equal to 0 (zero), "" , or false.

If a string and a number are compared, attempt to convert the string to a number and then check for equality.

If an object and a string are compared, attempt to convert the object to a string and then check for equality.

If an object and a number are compared, attempt to convert the object to a number and then check for equality.

If both operands of an equality operation are objects, the addresses of the two objects are checked for equality.

Quote from:

Pure JavaScript (Paperback)

by R. Allen Wyke (Author), Jason Gilliam (Author), Charlton Ting (Author)

# Paperback: 1448 pages

# Publisher: Sams; 1st edition (August 1999)

# Language: English

# ISBN-10: 0672315475

# ISBN-13: 978-0672315473

5. 8. Type Conversion
5. 8. 1. Type Conversion
5. 8. 2. Type-conversion adheres to the following rules
5. 8. 3. Converting to a String
5. 8. 4. Using Number's toString() method in radix mode
5. 8. 5. Converting to a Number
5. 8. 6. parseInt() method
5. 8. 7. parseInt() in radix mode
5. 8. 8. If decimal numbers contain a leading zero, it's always best to specify the radix as 10 so that you won't accidentally end up with an octal value.
5. 8. 9. parseFloat() method
5. 8. 10. Type Casting
5. 8. 11. Casting to Boolean value
5. 8. 12. Casting to Number
5. 8. 13. Casting type to string
5. 8. 14. parseInt("33.00")
5. 8. 15. parseFloat("1.23e-2")
5. 8. 16. parseFloat("1.45inch")
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.