Skip to content

Commit 975893b

Browse files
committed
fix mistakes pointed out by a reviewer
1 parent c386f50 commit 975893b

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

Sprint-1/3-mandatory-interpret/1-percentage-change.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ console.log(`The percentage change is ${percentageChange}`);
1212
// Read the code and then answer the questions below
1313

1414
// a) How many function calls are there in this file? Write down all the lines where a function call is made
15-
// There are 2 function calls in this file:
15+
// There are 5 function calls in this file:
1616
// Lines 4 and 5 - replaceAll function call
17+
// Lines 4 and 5 - Number function call
18+
// Line 10 - console.log function call
1719

1820
// b) Run the code and identify the line where the error is coming from - why is this error occurring? How can you fix this problem?
1921
// Line 5 had an error because there was a missing comma between "," and "" in replaceAll function call. - SyntaxError

Sprint-1/3-mandatory-interpret/2-time-format.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const result = `${totalHours}:${remainingMinutes}:${remainingSeconds}`;
1010
console.log(result);
1111

1212
// testing different cases
13-
function movieLengthToDuration(movieLength) {
13+
function movieLengthFormatter(movieLength) {
1414
const remainingSeconds = movieLength % 60;
1515
const totalMinutes = (movieLength - remainingSeconds) / 60;
1616

@@ -21,18 +21,18 @@ function movieLengthToDuration(movieLength) {
2121
return result;
2222
}
2323

24-
console.log(movieLengthToDuration(0));
25-
console.log(movieLengthToDuration(59));
26-
console.log(movieLengthToDuration(10000));
27-
console.log(movieLengthToDuration(-100));
28-
console.log(movieLengthToDuration(200.4));
24+
console.log(movieLengthFormatter(0));
25+
console.log(movieLengthFormatter(59));
26+
console.log(movieLengthFormatter(10000));
27+
console.log(movieLengthFormatter(-100));
28+
console.log(movieLengthFormatter(200.4));
2929
// For the piece of code above, read the code and then answer the following questions
3030

3131
// a) How many variable declarations are there in this program?
3232
// There are 6 variable declarations.
3333

3434
// b) How many function calls are there?
35-
// There are no function calls.
35+
// There is `console.log` as a function call.
3636

3737
// c) Using documentation, explain what the expression movieLength % 60 represents
3838
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators
@@ -45,7 +45,7 @@ console.log(movieLengthToDuration(200.4));
4545

4646
// e) What do you think the variable result represents? Can you think of a better name for this variable?
4747
// The variable result represents the final result of the movie duration in the format of H:M:S.
48-
// The better name fort this variable could be movieDuration.
48+
// The better name for this variable could be movieLengthFormatted.
4949

5050
// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
5151
// There are a couple of edge cases that this code will not work for:

0 commit comments

Comments
 (0)