Content-Length: 280655 | pFad | http://github.com/devtarun/TheAlgorithms-JavaScript/commit/8cbaf2e2994b5f17c0589a38414c67081015c3b1

B3 convertion: ounce to kilogram (#1248) · devtarun/TheAlgorithms-JavaScript@8cbaf2e · GitHub
Skip to content

Commit 8cbaf2e

Browse files
authored
convertion: ounce to kilogram (TheAlgorithms#1248)
* Added ounces to kilograms convertion * Added PR suggestions * changed to export default
1 parent 7256e53 commit 8cbaf2e

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

Conversions/OuncesToKilograms.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* This function converts ounces to kilograms
3+
* https://en.wikipedia.org/wiki/Ounce
4+
* @constructor
5+
* @param {number} oz - Amount of ounces to convert to kilograms
6+
*/
7+
const ouncesToKilograms = (oz) => {
8+
return oz * 28.3498 / 1000
9+
}
10+
11+
export default ouncesToKilograms
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import ouncesToKilograms from '../OuncesToKilograms'
2+
3+
test('Convert 60 ounces to kilograms', () => {
4+
expect(parseFloat(ouncesToKilograms(60).toFixed(3))).toBe(1.701)
5+
})

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/devtarun/TheAlgorithms-JavaScript/commit/8cbaf2e2994b5f17c0589a38414c67081015c3b1

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy