Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
BOOK: Professional JavaScript for Web Developers 2nd edition ISBN: 9780470227800
This is the forum to discuss the Wrox book Professional JavaScript for Web Developers, 2nd Edition by Nicholas C Zakas; ISBN: 9780470227800
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional JavaScript for Web Developers 2nd edition ISBN: 9780470227800 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 9th, 2010, 05:10 PM
Registered User
Join Date: Jul 2010
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Type coercion issue

On Page 60 section entitled 'Equal and Not Equal'

When performing conversions it states the following:

'If one operand is a string and the other is a number, attempt to convert the string into a number before checking for equality.'

Yet on page 482 in the first example given as follows:

alert(5 == "5")
alert(5 === “5”);

The explanation in the following paragraph states:

'In this code, the number 5 and the string “5” are compared using the equal operator and the identically equal operator. The equal operator first converts the number 5 into the string “5” and then compares it with the other string “5”, resulting in true.'

Page 60 clearly states that under such circumstances a string is converted into a number before checking for equality, but the opposite is being stated in the example on page 482, so the question is which is correct?

Last edited by Mikeos; September 9th, 2010 at 05:12 PM..
  #2 (permalink)  
Old September 9th, 2010, 07:57 PM
nzakas's Avatar
Wrox Author
Join Date: Dec 2004
Location: Peabody, MA, USA.
Posts: 217
Thanks: 0
Thanked 5 Times in 5 Posts

Page 60 is correct.
Nicholas C. Zakas
Author, Professional JavaScript for Web Developers (ISBN 0764579088)

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Conversion from type 'DBNull' to type 'Boolean' is not valid. alcsew ASP.NET 2.0 Basics 1 October 24th, 2009 09:42 PM
Conversion from type 'DBNull' to type 'String' is not valid. phuc2583 ASP.NET 3.5 Professionals 4 October 1st, 2009 09:46 AM
Issue with SqlData Type in ASP.NET snejsnej ASP.NET 1.0 and 1.1 Professional 1 August 30th, 2006 04:47 PM
type issue m3rajk Beginning PHP 3 August 6th, 2003 05:19 PM

All times are GMT -4. The time now is 02:47 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.