Skip to content

Commit 571227a

Browse files
committed
doe 0.js
1 parent 22d3cf7 commit 571227a

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

Sprint-2/errors/0.js

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,34 @@
33
// call the function capitalise with a string input
44
// interpret the error message and figure out why an error is occurring
55

6+
/*
7+
we are creating a variable with (let = nameVariable) but the same time we can not assing
8+
the value in the same line.
9+
instead we should call directly the (str = valueAssigned) and with this will Worker.
10+
*/
11+
12+
13+
// function capitalise(str) {
14+
// let str = `${str[0].toUpperCase()}${str.slice(1)}`;
15+
// return str;
16+
// }
17+
18+
19+
20+
/*================== fixed =======================*/
21+
622
function capitalise(str) {
7-
let str = `${str[0].toUpperCase()}${str.slice(1)}`;
23+
str = `${str[0].toUpperCase()}${str.slice(1)}`;
824
return str;
925
}
26+
27+
console.log(capitalise("alejandra"));
28+
29+
30+
/*
31+
In this function we are taking a parameter the string "alejadra" this
32+
entry in the function and assigned in the str = takin the firs character[0].toUpperCase()
33+
and using the function upper... to convert this in capital letter.
34+
but we still need the rest of the string and we use the interpolation to concatenate
35+
the rest calling the string from the position 1 with str.slice(1).
36+
*/

0 commit comments

Comments
 (0)