[Javascript] Multiplication

Andrew Dunn adunn at mail.interworx.com.au
Sun Jun 24 18:45:34 CDT 2001


Hi,
   I've looked in my JavaScript book and I can't find anything like the
VBScript formatNumber function. You may have to define your own. I guess it
would be easy to do. Just check if it is a valid number format and then
check how many (if any) numbers are after the decimal point using indexOf()
and add the zeros accordingly.

-----Original Message-----
From: javascript-admin at LaTech.edu [mailto:javascript-admin at LaTech.edu]On
Behalf Of Andrew Gibson
Sent: Sunday, 24 June 2001 11:03 AM
To: javascript at LaTech.edu
Subject: [Javascript] Multiplication


Think this has been asked before but how do I format numbers after
multiplication

eg

var myNumber=6*1.5

that returns 9 but how do I make it 9.00

or how do I make 3*1.5     4.50  rather than 4.5

In ASP we would just go formatnumber(myNumber,2)  is there no similar
function in Javascript?

Andrew



_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
http://www.LaTech.edu/mailman/listinfo/javascript





More information about the Javascript mailing list