troubleshooting Question

XJS: how do i take a currency format and append a zero if there is none

Avatar of badtz7229
badtz7229Flag for United States of America asked on
JavaScriptXML
5 Comments2 Solutions128 ViewsLast Modified:
I have an element : <totalPrice>20.9</totalPrice>

I'm storing this into a variable:
var totalPrice  = node.ValueOfSelect("Info/priceInfo/totalPrice");

in another variable, i'm removing the decimal:
var Info =  totalPrice.replace( '.', '');

However, this returns 209. I want to have it append a 0 at the end so that it returns 2090

It should works as below:

i.e    20.9 --> 2090
      11.15 --> 1115
       1.13 --> 113
ASKER CERTIFIED SOLUTION
Lee
Programmer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros