Skip to content

Commit bc1dbce

Browse files
committed
fixed small errors
1 parent f738b2f commit bc1dbce

4 files changed

Lines changed: 4 additions & 5 deletions

File tree

‎Sprint-2/1-key-exercises/4-random.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,4 @@ console.log(num);
2626
//Next, we need to multiply the result from Math.random() by 100. This may give us the result of a decimal between 0 and 100.
2727
//Next step is to use Math.floor() wich then rounds down the decimal number to the nearest whole integer. This then means that the result will be a whole number between 0 and 99.
2828
//But we want 1-100, so we add 1 to the result of Math.floor() this then changes the range to be inclusive of 1 and 100.
29-
//After adding 1, we need to round down the number to the nearest interger, this is done by using Math.floor(). After this we will have a whole number between maximum and minimum.
3029
//Therefore, the final result of num will be a random whole number between 1 and 100, inclusive.

‎Sprint-2/2-mandatory-errors/3.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const cardNumber = "4533787178994213";
2-
const last4Digits = cardNumber.slice(-4);
1+
const cardNumber = 4533787178994213;
2+
const last4Digits = String(cardNumber).slice(-4);
33

44
// The last4Digits variable should store the last 4 digits of cardNumber
55
// However, the code isn't working

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ console.log(`The percentage change is ${percentageChange}`);
1717

1818
// 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?
1919

20-
//>SyntaxError: missing a comma to separate the arguments
20+
//>SyntaxError: missing a comma to separate the arguments, the error is on line 5
2121

2222
// c) Identify all the lines that are variable reassignment statements
2323
//>carPrice = Number(carPrice.replaceAll(",", "")); and priceAfterOneYear = Number(priceAfterOneYear.replaceAll(",", ""));

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ console.log(result);
2020
// c) Using documentation, explain what the expression movieLength % 60 represents
2121
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators
2222

23-
//>movieLength % 60 means finding the remainder after dividing movieLength by 60. movieLength = 8784 so we need to do: 8784 % 60 = 146.4 and the nearest whole integer is 146.
23+
//>movieLength % 60 means finding the remainder after dividing movieLength by 60. movieLength = 8784 so we need to do: 8784/60 = 146.4 and the nearest whole integer is 146.
2424
//So there are 146 complete groups of 60. we then multiply; 146 x 60= 8760 --> 8784 - 8760 = 24 so 8784 % 60 = 24 and therefore remainingSeconds becomes 24.
2525
//8784/60 = 146.4. and 8784 % 60 = 24 as this is the remainder.
2626

0 commit comments

Comments
 (0)