You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Sprint-3/1-key-errors/0.js
+9-9Lines changed: 9 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -5,15 +5,15 @@
5
5
// call the function capitalise with a string input
6
6
// interpret the error message and figure out why an error is occurring
7
7
8
-
functioncapitalise(str){
9
-
letstr=`${str[0].toUpperCase()}${str.slice(1)}`;
10
-
returnstr;
11
-
}
12
-
13
-
// =============> write your explanation here SyntaxError: Identifier 'str' has already been declared => line 10 varibale str should not be declared again.
// let str = `${str[0].toUpperCase()}${str.slice(1)}`;
17
10
// return str;
18
11
// }
19
-
// console.log(capitalise("hello world"));
12
+
13
+
// =============> write your explanation here SyntaxError: Identifier 'str' has already been declared => line 10 varibale str should not be declared again.
Copy file name to clipboardExpand all lines: Sprint-3/1-key-errors/1.js
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -4,14 +4,14 @@
4
4
// =============> write your prediction here D: Answer => variable decimalNumber is declared twice : one time in the parameter and another time inside the function
5
5
6
6
7
-
functionconvertToPercentage(decimalNumber){
8
-
//const decimalNumber = 0.5;
9
-
constpercentage=`${decimalNumber*100}%`;
7
+
// function convertToPercentage(decimalNumber) {
8
+
// //const decimalNumber = 0.5;
9
+
// const percentage = `${decimalNumber * 100}%`;
10
10
11
-
returnpercentage;
12
-
}
11
+
// return percentage;
12
+
// }
13
13
14
-
console.log(decimalNumber);
14
+
// console.log(decimalNumber);
15
15
16
16
// =============> write your explanation here
17
17
// solution :Also in line 15 console.log is trying print a variable which is not defined instead of calling the function convertToPercentage .
0 commit comments