spacer
Yehuda Shiran October 15, 2000
Converting Zero-Leading Strings to Integers
Tips: October 2000

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
ActiveState Debuts Open Source Business Suite
Salesforce Offers Visual App Builder
Codesion Steps Out From CVS's Shadow

When you convert a zero-leading string to an integer, you get the most significant zero. For example:

parseInt("009");

yields zero (0). You can get around it by specifying a radix of 10. For example:

parseInt("009", 10);

yields 9. Specifying any other radix which is smaller than 10 will yield zero (0). Try it:

This tip has been contributed by KP.


People who read this tip also read these tips:

Look for similar tips by subject:


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

webref The latest from WebReference.com Browse >
Use Web Caching to Make Your Web Site Faster · Creating an Online Shopping Cart Mechanism in PHP · Log JavaScript Errors Using an AJAX-driven Web Service
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Configuring Granular Settings for a Database Level Audit · The Perils of a Web 2.0 Transition on Your Business Processes · Facebook Redesigns Site —Again — Nears 400M Mark