Skip to content

Commit f70662a

Browse files
committed
commented out the correct code
1 parent 64fd843 commit f70662a

File tree

6 files changed

+21
-24
lines changed

6 files changed

+21
-24
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33

44
// call the function capitalise with a string input
55
// interpret the error message and figure out why an error is occurring
6-
6+
/*
77
function capitalise(str) {
88
let str = `${str[0].toUpperCase()}${str.slice(1)}`;
99
return str;
10-
}
10+
}*/
1111

1212
// =============> Yeah, str name for the variable is already being used as the parameter of the function,
1313
// that's why we can't declare it agian as being done in line 8.
1414
// =============> the correct code would be as follows:
1515

16-
/*function capitalise(str) {
16+
function capitalise(str) {
1717
let capitaliseStr = `${str[0].toUpperCase()}${str.slice(1)}`;
1818
return capitaliseStr;
19-
}*/
19+
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
//and logically there is no need for initializing decimalNumber again with 0.5 value as in that case the method would return 50% always
55
// Try playing computer with the example to work out what is going on
66

7-
function convertToPercentage(decimalNumber) {
7+
/*function convertToPercentage(decimalNumber) {
88
const decimalNumber = 0.5;
99
const percentage = `${decimalNumber * 100}%`;
1010
1111
return percentage;
12-
}
12+
}*/
1313

1414
console.log(decimalNumber);
1515

@@ -18,8 +18,8 @@ console.log(decimalNumber);
1818
// Finally, correct the code to fix the problem
1919
// =============> the correct code would be as follows:-
2020

21-
/*function convertToPercentage(decimalNumber) {
21+
function convertToPercentage(decimalNumber) {
2222
const percentage = `${decimalNumber * 100}%`;
2323

2424
return percentage;
25-
}*/
25+
}

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
// =============> In the parameters of function we can write the name of the variable but not the actual value.
77
//we write actual value when we call the function.
88

9-
function square(3) {
9+
/*function square(3) {
1010
return num * num;
11-
}
11+
}*/
1212

1313
// =============> write the error message here
1414
/*
@@ -24,9 +24,8 @@ SyntaxError: Unexpected number
2424

2525
// =============> write your new code here
2626

27-
/*
27+
2828
function square(num) {
2929
return num * num;
3030
}
31-
*/
3231

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
//I think that the problem is our function multiply does not return any value but write in console
55
// However, we are calling the function inside another console.log and expecting the function to return some value.
66

7-
function multiply(a, b) {
7+
/*function multiply(a, b) {
88
console.log(a * b);
99
}
1010
1111
console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
12-
12+
*/
1313
// =============> Yeah, when we run the code we get the following output which shows that second console is not able to get the value from the function as the function does not return any value.
1414
/*
1515
320
@@ -18,9 +18,8 @@ The result of multiplying 10 and 32 is undefined
1818

1919
// Finally, correct the code to fix the problem
2020
// =============> write your new code here
21-
/*
21+
2222
function multiply(a, b) {
2323
return a * b;
2424
}
2525
console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
26-
*/

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// Predict and explain first...
22
// =============> write your prediction here
33
// In the below function, after return there is a semi colon which syntactically would just return nothing and any line of code below that would not run
4-
function sum(a, b) {
4+
/*function sum(a, b) {
55
return;
66
a + b;
7-
}
7+
}*/
88

99
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
1010

@@ -13,8 +13,8 @@ console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
1313

1414
// Finally, correct the code to fix the problem
1515
// =============> write your new code here
16-
/*
16+
1717
function sum(a, b) {
1818
return a + b;
1919
}
20-
*/
20+

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@
77
*/
88
const num = 103;
99

10-
function getLastDigit(num) {
10+
/*function getLastDigit(num) {
1111
return num.toString().slice(-1);
1212
}
1313
1414
console.log(`The last digit of 42 is ${getLastDigit(42)}`);
1515
console.log(`The last digit of 105 is ${getLastDigit(105)}`);
1616
console.log(`The last digit of 806 is ${getLastDigit(806)}`);
17+
*/
1718

1819
// Now run the code and compare the output to your prediction
1920
// =============> write the output here
@@ -27,13 +28,11 @@ The last digit of 806 is 3
2728

2829
// Finally, correct the code to fix the problem
2930
// =============> write your new code here
30-
/*
31+
3132
function getLastDigit(num) {
3233
return num.toString().slice(-1);
3334
}
3435

3536
console.log(`The last digit of 42 is ${getLastDigit(42)}`);
3637
console.log(`The last digit of 105 is ${getLastDigit(105)}`);
3738
console.log(`The last digit of 806 is ${getLastDigit(806)}`);
38-
39-
*/

0 commit comments

Comments
 (0)