Skip to content

Commit a28e020

Browse files
committed
updated my prediction on errors, 0.js
1 parent e2929c2 commit a28e020

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

Sprint-2/errors/0.js

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55

66

77
/*
8-
we are creating a variable with (let = nameVariable) but the same time we can not reassign
9-
the value in the same line.
10-
instead we should call directly the (str = valueAssigned) and with this will Work
8+
- Occur SyntaxError because the var str has been declared in the in the parameter, so to fix this we
9+
just need to assign the new value. and remove the let.
10+
11+
- Then call the function
1112
*/
1213

1314

@@ -16,6 +17,8 @@
1617
// return str;
1718
// }
1819

20+
// console.log(capitalize("alejandra"));
21+
1922

2023

2124
/*================== fixed =======================*/
@@ -29,9 +32,12 @@ console.log(capitalize("alejandra"));
2932

3033

3134
/*
32-
In this function we are taking a parameter the string "alejadra" this
33-
entry in the function and assigned in the str = taking the firs character[0].toUpperCase()
34-
and using the function upper... to convert this in capital letter.
35-
but we still need the rest of the string and we use the interpolation to concatenate
36-
the rest calling the string from the position 1 with str.slice(1).
37-
*/
35+
In this function, we are taking a string parameter, "alejandra", as input.
36+
Inside the function, we modify the string by capitalizing the first character.
37+
- First, we access the first character of the string using `str[0]` and use the `toUpperCase()` method
38+
to convert it to a capital letter.
39+
- Then, we use `str.slice(1)` to extract the rest of the string, starting from the second character.
40+
- Finally, we combine the capitalized first letter and the rest of the string using a template literal.
41+
42+
The result is for the input "alejandra", the output is "Alejandra".
43+
*/

0 commit comments

Comments
 (0)