File tree Expand file tree Collapse file tree 1 file changed +28
-1
lines changed
Expand file tree Collapse file tree 1 file changed +28
-1
lines changed Original file line number Diff line number Diff line change 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+
622function 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+ */
You can’t perform that action at this time.
0 commit comments