Skip to content

Commit 69791bc

Browse files
revising and reviewing the content further expalining some of the reasons
1 parent 4d8de06 commit 69791bc

4 files changed

Lines changed: 12 additions & 6 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
1212

1313
// =============> write your explanation here
14-
//The console.log() inside the funtion will print a*b but when we call the function will return() undefined means will return nothing)for the two variables a and b
14+
//The console.log() inside the funtion will print a*b but when we call the function will return undefined
1515

1616
// Finally, correct the code to fix the problem
1717
// =============> write your new code here

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
// Predict and explain first...
22
// =============> write your prediction here
3-
// The function suppose to return the sum of the two variables but we will encounter an error probably a syntax Error
3+
// The function suppose to return the sum of the two variables but we will encounter an error as the code after return is unreachable.
44

55

66
// function sum(a, b) {
77
// return;
88
// a + b;
99
// }
1010
// console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
11-
// As we return nothing by closing the line with a semicolon hence a + b is not returned where we tell the computer to exit and go back to global scope and the computer will not be able to read the lines after that
11+
1212
// =============> write your explanation here
1313

14+
// As we return nothing by closing the line with a semicolon hence a + b is not returned where we tell the computer to exit and go back to global scope and the computer will not be able to read the lines after that
15+
1416
// Finally, correct the code to fix the problem
1517
// =============> write your new code here
1618

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

Lines changed: 6 additions & 2 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 and reverse it
6-
// However, since there is no parameter or local variable 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

@@ -40,3 +40,7 @@ function getLastDigit(num) {
4040

4141
// This program should tell the user the last digit of each number.
4242
// Explain why getLastDigit is not working properly - correct the problem
43+
/* 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.
44+
where it uses the golabal varaible 'num' decalred outside the funtion and already set to 103
45+
46+
The correct code includes a parameter 'number' in the difination this allows the function to accept the number passed to it when called*/

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ console.log(formatTimeDisplay(60))
3535

3636
// e) What is the return value assigned to num when pad is called for the last time in this program? Explain your answer
3737
// =============> "01"
38-
// When it is call for the last time it adds 0 before 1 to make it 2 characters long
38+
// When it is called for the last time it adds 0 before 1 to make it 2 characters long

0 commit comments

Comments
 (0)