Skip to content

Instantly share code, notes, and snippets.

@youngjinmo
Created November 17, 2018 05:04
Show Gist options
  • Save youngjinmo/284af07448fe2bf5a42feb3571b6f302 to your computer and use it in GitHub Desktop.
Save youngjinmo/284af07448fe2bf5a42feb3571b6f302 to your computer and use it in GitHub Desktop.
var bills = [50.23, 19.12, 34.01,
100.11, 12.15, 9.90, 29.11, 12.99,
10.00, 99.22, 102.20, 100.10, 6.77, 2.22
];
var totals = bills.map(function(element) {
element *= 1.15;
element = element.toFixed(2);
return Number(element);
});
console.log(totals);
@youngjinmo
Copy link
Author

tip

If you want convert string to number, use Number() method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment