Skip to content

Commit 1d7c01b

Browse files
reedited the answers
1 parent 9d762f3 commit 1d7c01b

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ console.log(decimalNumber);
1717

1818
// =============> write your explanation here
1919
when the program run it give a SyntaxError: Identifier 'decimalNumber' has already been declared. This is because the variable decimalNumber is declared twice in the function
20-
convertToPercentage, and inside the function with the constant varible CSSStyleDeclaration. also using the function name decimalNumber with the console.log function will give an error because the function name should be
20+
convertToPercentage, and inside the function with the constant varible it redeclared again also using the function name decimalNumber with the console.log function will give an error because the function name should be
2121
to fix this error we can remove the const variable declaration of decimalNumber from the function and use the function name
2222
'ConvertToPercentage' to recall the function and pass the value of the decimalNumber.CSSStyleDeclaration
2323

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44
// this function should square any number but instead we're going to get an error
55

66
// =============> write your prediction of the error here
7-
// the error will occur because the paramater of the function is not a valid variable name as it is a number.
8-
// also the variable num is not declared in the function and this will give an error when the program run because the function will not know what the value of the num is.
7+
the error will occur because the paramater of the function is not a valid variable name as it is a number.
8+
also the variable num is not declared in the function and this will give an error when the program run because the function will not know what the value of the num is.
99

1010
function square(3) {
1111
return num * num;
1212
}
1313

1414
// =============> write the error message here
15-
// function square(3) {
16-
// ^
15+
function square(3) {
16+
^
1717

18-
// SyntaxError: Unexpected number
18+
SyntaxError: Unexpected number
1919

2020
// =============> explain this error message here it means that the paramater of the function is an unexpected number (3) and this is not a valid variable number.
2121
I deleted the paramater of the function and run the programe and I get this error:

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Predict and explain first...
22

33
// =============> write your prediction here
4-
// I prediact that the error will occur because the function multiply does not return any value and this will make the console.log function to print undefined instead.
4+
I prediact that the error will occur because the function multiply does not return any value and this will make the console.log function to print undefined instead.
55

66

77
function multiply(a, b) {
@@ -11,15 +11,15 @@ function multiply(a, b) {
1111
console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
1212

1313
// =============> write your explanation here
14-
// when the program run it give this output:
14+
when the program run it give this output:
1515

16-
// 320
17-
// The result of multiplying 10 and 32 is undefined
16+
320
17+
The result of multiplying 10 and 32 is undefined
1818

19-
// 320: the out put for the console.log inside the function
19+
320: the out put for the console.log inside the function
2020

21-
// while the ouout the out put for the console.log function out of the function returned the string provided in the function and an undefiened because the function multibly doesn't return any value.
22-
// to fix this error we need to change the console.log function inside the function to return.
21+
while the ouout the out put for the console.log function out of the function returned the string provided in the function and an undefiened because the function multibly doesn't return any value.
22+
to fix this error we need to change the console.log function inside the multiply function to return.
2323

2424

2525
// Finally, correct the code to fix the problem

0 commit comments

Comments
 (0)