Skip to content

Commit e307d6b

Browse files
committed
done 1.js
1 parent 716d278 commit e307d6b

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

Sprint-2/debug/1.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
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+
823
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);

Sprint-2/errors/0.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
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
// }
@@ -19,12 +20,12 @@
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
/*

0 commit comments

Comments
 (0)