Skip to content

Commit b62e143

Browse files
committed
Added ounces to kilograms convertion
1 parent 0fab492 commit b62e143

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

Conversions/OuncesToKilograms.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/* https://en.wikipedia.org/wiki/Ounce returns it up to 3 decimal places */
2+
const ouncesToKilograms = (oz) => {
3+
let res = oz * 28.3498 / 1000
4+
res = res.toFixed(3)
5+
return parseFloat(res)
6+
}
7+
8+
export { ouncesToKilograms }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { ouncesToKilograms } from '../OuncesToKilograms'
2+
3+
describe('Testing OuncesToKilogram', () => {
4+
it('should return ', () => {
5+
expect(ouncesToKilograms(60)).toBe(1.701)
6+
})
7+
})

0 commit comments

Comments
 (0)