Skip to content

Commit 851893c

Browse files
committed
Address the issues from the pull request comments
1 parent 75172a0 commit 851893c

File tree

6 files changed

+16
-25
lines changed

6 files changed

+16
-25
lines changed

Sprint-2/1-key-errors/1.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,5 @@ console.log(decimalNumber);
2525
// =============> write your new code here
2626

2727
function percentaged(decimalNumber) {
28-
const constant = 0.5;
29-
const percentage = `${constant * 100}%`;
30-
31-
return percentage;
32-
}
28+
return `${decimalNumber * 100}%`;
29+
}

Sprint-2/2-mandatory-debug/0.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,5 @@ console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
1919
// =============> write your new code here
2020

2121
function product(a, b) {
22-
const result = a * b;
23-
console.log(result)
24-
return result;
25-
}
22+
return a * b;
23+
}

Sprint-2/3-mandatory-implement/1-bmi.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
// It should return their Body Mass Index to 1 decimal place
1616

1717
function calculateBMI(weight, height) {
18-
// return the BMI of someone based off their weight and height
19-
const result = weight / Math.pow(height, 2);
20-
return result.toFixed(1);
21-
}
18+
// return the BMI of someone based off their weight and height
19+
const result = weight / Math.pow(height, 2);
20+
const bmiString = result.toFixed(1);
21+
return Number(bmiString);
22+
}

Sprint-2/3-mandatory-implement/2-cases.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,5 @@
1616
// This might help https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase
1717

1818
function toUpperSnakeCase(string) {
19-
let result = `${string}`
20-
.split(" ")
21-
.map(word => word.toUpperCase())
22-
.reduce((accumulator, currentValue) => accumulator + "_" + currentValue);
23-
24-
return result;
25-
}
19+
return String(string).toUpperCase().replaceAll(" ", "_");
20+
}

Sprint-2/4-mandatory-interpret/time-format.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,19 @@ console.log(formatTimeDisplay(number));
2929
// b) What is the value assigned to num when pad is called for the first time?
3030
// =============> write your answer here
3131

32-
// 0
32+
// "0"
3333

3434
// c) What is the return value of pad is called for the first time?
3535
// =============> write your answer here
3636

37-
// 00
37+
// "00"
3838

3939
// d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer
4040
// =============> write your answer here
4141

42-
// 1
42+
// "1"
4343

4444
// e) What is the return value assigned to num when pad is called for the last time in this program? Explain your answer
4545
// =============> write your answer here
4646

47-
// 01
47+
// "01"

Sprint-2/5-stretch-extend/format-time.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
function formatAs12HourClock(time) {
66
let hours = Number(time.slice(0, 2));
7-
const minutes = time.slice(3, 5);
7+
const minutes = time.slice(-2);
88

99
if (hours === 24) {
1010
hours = 0;

0 commit comments

Comments
 (0)