Jump to content

Number Object, .tofixed(2);


crazyswede
 Share

Recommended Posts

Balances = new Number(0); <-- here I establish my number objectBalances.balance = Number(0);Balances.ColumbiaBeginBalance = Number(0);Balances.ColumbiaEndBalance = Number(0);Balances.boaBeginBalance = Number( 0);Balances.boaEndBalance = Number(0);-------------------------------------------------------------xxx=123.123456iii=xxx.toFixed(2); <--- this works when I type a literal number******************Balances.balance = 123.123456;<-- this works, too, but I can't have 'Balances.balance' be the same number all the time.xxx= Balances.balance;iii=xxx.toFixed(2); ******************---------- this is how I need it -------------------xxx= Balances.balance;<-- when I use a variable, it doesn't workiii=xxx.toFixed(2); Microsoft JScript runtime error '800a01b6' Object doesn't support this property or method /books/cfpCheckBook2.asp, line 271  ******************---------- would this be a possible option?: Doesn't work, either. iii= Balances.balance.toFixed(2);

Link to comment
Share on other sites

Your use of Number() is really unnecessary, first of all. Just saying x=5 creates a Number object. Secondly, you are adding properties to the Number object. I would create a separate Balances object. Ie,

var Balances = {  balance: 0,  ColumbiaBeginBalance: 0,  ColumbiaEndBalance: 0,  boaBeginBalance: 0,  boaEndBalance: 0}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...