Skip to content

Commit 5a1f129

Browse files
uncommingting correct code to be able to run
1 parent 142dcbd commit 5a1f129

2 files changed

Lines changed: 15 additions & 15 deletions

File tree

‎Sprint-3/1-key-errors/0.js‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
// call the function capitalise with a string input
66
// interpret the error message and figure out why an error is occurring
77

8-
function capitalise(str) {
9-
let str = `${str[0].toUpperCase()}${str.slice(1)}`;
10-
return str;
11-
}
12-
13-
// =============> write your explanation here SyntaxError: Identifier 'str' has already been declared => line 10 varibale str should not be declared again.
14-
// =============> write your new code
158
// function capitalise(str) {
16-
// str = `${str[0].toUpperCase()}${str.slice(1)}`;
9+
// let str = `${str[0].toUpperCase()}${str.slice(1)}`;
1710
// return str;
1811
// }
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.
14+
// =============> write your new code
15+
function capitalise(str) {
16+
str = `${str[0].toUpperCase()}${str.slice(1)}`;
17+
return str;
18+
}
19+
console.log(capitalise("hello world"));

‎Sprint-3/1-key-errors/1.js‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
// =============> write your prediction here D: Answer => variable decimalNumber is declared twice : one time in the parameter and another time inside the function
55

66

7-
function convertToPercentage(decimalNumber) {
8-
//const decimalNumber = 0.5;
9-
const percentage = `${decimalNumber * 100}%`;
7+
// function convertToPercentage(decimalNumber) {
8+
// //const decimalNumber = 0.5;
9+
// const percentage = `${decimalNumber * 100}%`;
1010

11-
return percentage;
12-
}
11+
// return percentage;
12+
// }
1313

14-
console.log(decimalNumber);
14+
// console.log(decimalNumber);
1515

1616
// =============> write your explanation here
1717
// 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

Comments
 (0)