Content-Length: 282228 | pFad | http://github.com/trasherdk/algorithms-javascript/commit/b634aa581c1472a9b530f2607bbeff33278b693c

70 conversion: liters to US gallons (#1255) · trasherdk/algorithms-javascript@b634aa5 · GitHub
Skip to content

Commit b634aa5

Browse files
authored
conversion: liters to US gallons (TheAlgorithms#1255)
1 parent 8cbaf2e commit b634aa5

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

Conversions/LitersToUSGallons.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* This function converts liters to US gallons
3+
* https://en.wikipedia.org/wiki/Gallon
4+
* @constructor
5+
* @param {number} liters - Amount of liters to convert to gallons
6+
*/
7+
const litersToUSGallons = (liters) => {
8+
return liters / 3.785411784
9+
}
10+
11+
export default litersToUSGallons
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import litersToUSGallons from '../LitersToUSGallons'
2+
3+
test('Convert 50 liters to US gallons', () => {
4+
expect(parseFloat(litersToUSGallons(50).toFixed(2))).toBe(13.21)
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/trasherdk/algorithms-javascript/commit/b634aa581c1472a9b530f2607bbeff33278b693c

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy