skip to Main Content

How do turn this number:
2499 to 24.99

I attempted:

const qty = 2499;
console.log(qty.toFixed(2));

and I get 2499.00

3

Answers


  1. const qty = 2499;
    console.log((qty / 100).toFixed(2));
    Login or Signup to reply.
  2. const qty = 2499 / 100;
    console.log(qty.toFixed(2));
    Login or Signup to reply.
  3. const qty = 2499;
    const decimal = qty / 100;
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search