Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8cbaf2e

Browse files
authored
convertion: ounce to kilogram (#1248)
* Added ounces to kilograms convertion* Added PR suggestions* changed to export default
1 parent7256e53 commit8cbaf2e

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+
constouncesToKilograms=(oz)=>{
8+
returnoz*28.3498/1000
9+
}
10+
11+
exportdefaultouncesToKilograms
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
importouncesToKilogramsfrom'../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)

[8]ページ先頭

©2009-2025 Movatter.jp