8000 Pass all tests · MonsWriter/javascript-exercises@05efd9b · GitHub
[go: up one dir, main page]

Skip to content

Commit 05efd9b

Browse files
committed
Pass all tests
1 parent 302b195 commit 05efd9b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

07_tempConversion/tempConversion.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1-
const convertToCelsius = function() {
1+
const convertToCelsius = function(farenheitDegrees) {
2+
let celsiusDegrees = (farenheitDegrees - 32) * 5 / 9;
3+
return round(celsiusDegrees);
24
};
35

4-
const convertToFahrenheit = function() {
6+
const convertToFahrenheit = function(celsiusDegrees) {
7+
let farenheitDegrees = (celsiusDegrees * 9 / 5) + 32;
8+
return round(farenheitDegrees);
59
};
610

11+
function round(number) {
12+
return Math.round(number * 10) / 10;
13+
}
14+
715
// Do not edit below this line
816
module.exports = {
917
convertToCelsius,

0 commit comments

Comments
 (0)
0