Diagram showing an overview of Javascript type conversion

E

Erwin Moller

java schreef:
Hi:

There is an introductory diagram for those confused by
javascript type wrangling (i.e., runtime type conversion
by the javascript interpreter).

http://mollypages.org/misc/jstypes.mp

It's not comprehensive but covers most common scenarios.

Best regards,
--j

type Status report

message /misc/jstypes.mp

description The requested resource (/misc/jstypes.mp) is not available.
 
R

Richard Cornford

java said:
There is an introductory diagram for those confused by
javascript type wrangling (i.e., runtime type conversion
by the javascript interpreter).

http://mollypages.org/misc/jstypes.mp

It's not comprehensive but covers most common scenarios.

On that diagram the statement "null and undefined convert to NaN so they
always return false when compared to a different type" is not true. The
algorithms for type-converting comparison do not type-convert null and
undefined values at all, and no type-conversation would result in null
becoming NaN (it become zero if type-converted into numbers (and so
would be equal to zero if type-conversion was part of the comparison
process)).

The "Comparison is intuitive" comment when both sides of comparisons are
the same type does not take account of the fact that - NaN == NaN - is
false (and - NaN != NaN - true).

Richard.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,076
Latest member
OrderKetoBeez

Latest Threads

Top