File tree Expand file tree Collapse file tree 2 files changed +22
-6
lines changed
Expand file tree Collapse file tree 2 files changed +22
-6
lines changed Original file line number Diff line number Diff line change 11// Predict and explain first...
22
3- function sum ( a , b ) {
3+ /*
4+ the reason why is returning undefined is because as soon the function find the return
5+ will stop reading the rest. also the addition is ignoring because we have the statement
6+ one line break after the return
7+
8+ function sum(a, b) {
49 return;
510 a + b;
611}
712
13+ */
14+
15+
16+
17+ //=================== this will work ==============
18+
19+ function sum ( a , b ) {
20+ return a + b ;
21+ }
22+
823console . log ( `The sum of 10 and 32 is ${ sum ( 10 , 32 ) } ` ) ;
Original file line number Diff line number Diff line change 11// Predict and explain first...
22
33// call the function capitalise with a string input
4- // interpret the error message and figure out why an error is occurring
4+ // interpret the error message and figure out why an error occurring
55
6- /*
6+
7+ /*
78 we are creating a variable with (let = nameVariable) but the same time we can not assing
89 the value in the same line.
910 instead we should call directly the (str = valueAssigned) and with this will Worker.
1011*/
1112
1213
13- // function capitalise (str) {
14+ // function capitalize (str) {
1415// let str = `${str[0].toUpperCase()}${str.slice(1)}`;
1516// return str;
1617// }
1920
2021/*================== fixed =======================*/
2122
22- function capitalise ( str ) {
23+ function capitalize ( str ) {
2324 str = `${ str [ 0 ] . toUpperCase ( ) } ${ str . slice ( 1 ) } ` ;
2425 return str ;
2526}
2627
27- console . log ( capitalise ( "alejandra" ) ) ;
28+ console . log ( capitalize ( "alejandra" ) ) ;
2829
2930
3031/*
You can’t perform that action at this time.
0 commit comments