Skip to content

Commit 161d044

Browse files
o.js has been fixed and output is Ramesh
1 parent c6a44f1 commit 161d044

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

  • Sprint-3/1-key-errors

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

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,23 @@
33

44
// call the function capitalise with a string input
55
// interpret the error message and figure out why an error is occurring
6+
//while calling a function capitalise occured a error. The error is occured due to declared of Str two times.
7+
8+
// /*function capitalise(str) {
9+
// let str = `${str[0].toUpperCase()}${str.slice(1)}`;
10+
// return str;
11+
// }
12+
// capitalise("Ramesh");*/
613

7-
function capitalise(str) {
8-
let str = `${str[0].toUpperCase()}${str.slice(1)}`;
9-
return str;
10-
}
11-
capitalise("Ramesh");
12-
console.log()
1314

1415
// =============> write your explanation here
16+
// to resolve this error we need to declared a new variable in step 9. after declaring a new variable it runs and give outputs.
17+
//which first letter is capital and other are remain same.
1518
// =============> write your new code here
19+
function capitalise(str) {
20+
let ab = `${str[0].toUpperCase()}${str.slice(1)}`;
21+
return ab;
22+
}
23+
capitalise("ramesh");
24+
// The correct code is given above i pass a value ramesh after running this function the output become Ramesh.
25+

0 commit comments

Comments
 (0)