Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > BOOK: Beginning JavaScript 5th Edition
|
BOOK: Beginning JavaScript 5th Edition
This is the forum to discuss the Wrox book Beginning JavaScript, 5th Edition by Jeremy McPeak; 978-1-118-90333-9
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning JavaScript 5th Edition section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 4th, 2015, 09:46 AM
Authorized User
 
Join Date: Dec 2015
Posts: 10
Thanks: 4
Thanked 5 Times in 4 Posts
Default Ch. 2, parseInt(): book claims can be used for converting to binary, etc.?

In the "Data Conversion" section of Chapter 2, the book claims that "you can use parseInt() to convert numbers to binary (Base 2), hex (Base 16), and other number systems." In reality, it does the opposite.

The method toString() is the method that is useful for converting a number to different number systems, not parseInt(). parseInt(10, 2) results in the number 2, as the book says, but that is not a conversion of ten into binary, but an interpretation of 10 as being binary already, in which case its base 10 value would be 2. The base 10 value of ten would be represented 1010 in binary.

Has anyone else noticed this error? Is there something I am missing here?
 
Old January 8th, 2016, 02:40 PM
jmcpeak's Avatar
Wrox Author
 
Join Date: Nov 2005
Posts: 87
Thanks: 0
Thanked 18 Times in 17 Posts
Default

No, you're not missing anything. The book is both wrong and extremely poorly worded in that passage.
The Following User Says Thank You to jmcpeak For This Useful Post:
Moby (January 9th, 2016)
 
Old January 9th, 2016, 12:22 AM
Authorized User
 
Join Date: Dec 2015
Posts: 10
Thanks: 4
Thanked 5 Times in 4 Posts
Default

Thanks for your reply. Can this be added to the errata for the book?





Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting JPEG images into binary Bassaam .NET Framework 2.0 5 August 1st, 2006 02:38 PM
Converting an ASCII character to binary? skyraider Visual Basic 2005 Basics 0 May 7th, 2006 08:20 PM
Converting from binary to xml Morrislgn Pro VB.NET 2002/2003 0 February 2nd, 2006 12:46 PM
parseInt - sort ascending crmpicco Javascript How-To 3 July 5th, 2005 09:13 AM





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