Skip to content

Instantly share code, notes, and snippets.

@scriptschat
Created September 23, 2020 13:03
Show Gist options
  • Save scriptschat/a1fbbfab5174e816c2b3cd6075709af7 to your computer and use it in GitHub Desktop.
Save scriptschat/a1fbbfab5174e816c2b3cd6075709af7 to your computer and use it in GitHub Desktop.
Solving number multiplication issue in JavaScript
function multiplyTest() {
var x = ((0.1 * 100) * (0.2 * 100)) / 10000;
console.log(x);
//We are dividing here with 10000 because we multiplye 2 different numbers with 100
//here console log statement will return exact answer 0.02
}
multiplyTest();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment