Skip to content

Commit a4f20f2

Browse files
meeting the requirements of the raised suggestions
1 parent 599853f commit a4f20f2

4 files changed

Lines changed: 18 additions & 20 deletions

File tree

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
1-
21
// Predict and explain first BEFORE you run any code...
32

43
// this function should square any number but instead we're going to get an error
54

65
// =============> write your prediction of the error here
7-
//I predict the funciton will throw a SyntaxEror as the perametters sould be valid variables like names or identifiers with upholding to the variable naming convention and in this case a number found
6+
//I predict the funciton will throw a SyntaxEror as the perametters sould be valid variables like names or identifiers with upholding to the variable naming convention and in this case a number found
87

98
// function square(3) {
109
// return num * num;
1110
// }
1211

1312
// =============> write the error message here
14-
//the Error is a syntax error: Unexpected number
13+
//the Error is a syntax error: Unexpected number
1514

1615
// =============> explain this error message here
1716
/* The function was givin a number as its perameter where in JS only allows varaible names and usnig a number causes a SyntaxError
18-
Also, the function was returning num*num where num is undefined causing a ReferenceError
17+
Also, the function was returning num*num where num is undefined causing a syntax error
1918
*/
2019

2120
// Finally, correct the code to fix the problem
2221

2322
// =============> write your new code here
2423

2524
function square(num) {
26-
return num * num;
27-
}
25+
return num * num;
26+
}
2827

29-
console.log(square(25));
28+
console.log(square(25));

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
// Predict the output of the following code:
44
// =============> Write your prediction here
5-
//getLastDigit will convert a number to a string
6-
// However, since there is no parameter or local variable to the function we might run into an Error
5+
//getLastDigit will convert a number to a string
6+
// However, since there is no parameter or local variable to the function we might run into an Error
77

88
// const num = 103;
99

@@ -31,16 +31,15 @@
3131

3232
function getLastDigit(num) {
3333
return num.toString().slice(-1);
34-
}
35-
36-
console.log(`The last digit of 42 is ${getLastDigit(42)}`);
37-
console.log(`The last digit of 105 is ${getLastDigit(105)}`);
38-
console.log(`The last digit of 806 is ${getLastDigit(806)}`);
34+
}
3935

36+
console.log(`The last digit of 42 is ${getLastDigit(42)}`);
37+
console.log(`The last digit of 105 is ${getLastDigit(105)}`);
38+
console.log(`The last digit of 806 is ${getLastDigit(806)}`);
4039

4140
// This program should tell the user the last digit of each number.
4241
// Explain why getLastDigit is not working properly - correct the problem
4342
/* the reason why getLastDigit isn't working properly is that it doesn't accept any arrguments where there isn't any perameters in its difination.
4443
where it uses the golabal varaible 'num' decalred outside the funtion and already set to 103
4544
46-
The correct code includes a parameter 'num' in the difination this allows the function to accept the number passed to it when called*/
45+
The correct code includes a parameter 'num' in the difination this allows the function to accept the number passed to it when called*/

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
// You will need to come up with an appropriate name for the function
1515
// Use the MDN string documentation to help you find a solution
1616
// This might help https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase
17-
function toUpperSnakeFormat(string) {
17+
function toUpperSnakeCase(string) {
1818
return string.toUpperCase().replaceAll(" ", "_");
1919
}
20-
console.log(toUpperSnakeFormat("hello there"));
21-
console.log(toUpperSnakeFormat("lord of the rings"));
20+
console.log(toUpperSnakeCase("hello there"));
21+
console.log(toUpperSnakeCase("lord of the rings"));

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ console.log(formatTimeDisplay(61));
2727
// Call formatTimeDisplay with an input of 61, now answer the following:
2828

2929
// b) What is the value assigned to num when pad is called for the first time?
30-
// =============> the first time pad was called with the totalHours
30+
// =============> the first time pad was called with the totalHours the value is 00:01:01
3131

3232
// c) What is the return value of pad is called for the first time?
3333
// =============> "00"
3434

3535
// d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer
36-
// =============> "1"
36+
// =============> 1
3737
// the last time, pad() is called with the remaining seconds which is value "1"
3838

3939
// e) What is the return value of pad when it is called for the last time in this program? Explain your answer

0 commit comments

Comments
 (0)