Skip to content

Commit cc701e7

Browse files
author
DouglasHdezT
committed
Add: Exmaples dump
1 parent 9ca3a0b commit cc701e7

9 files changed

Lines changed: 46 additions & 14 deletions

File tree

1-Let&Const/Example1.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,6 @@ function showPractcalScope(){
6363
console.log("b = " + b);
6464
}
6565

66-
66+
showVarScope();
67+
showLetScope();
68+
showPractcalScope();

1-Let&Const/Example2.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@ function showVariables(){
1313

1414
console.log(window.variable1);
1515
console.log(window.variable2);
16-
}
16+
}
17+
18+
showVariables();

2-ArrowFunctions/Exercise1.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const persona = {
2+
name: "Nathaly",
3+
lastname:"Alvarenga",
4+
age: 23,
5+
gender: "Female"
6+
}
7+
8+
const fun = (person) =>{
9+
console.log(person.name);
10+
person.name = "Douglas"
11+
console.log(person.name);
12+
console.log(person.lastname);
13+
console.log(person.age);
14+
console.log(person.gender);
15+
}
16+
17+
fun(persona);
18+
console.log(persona);

3-AsyncFuntions/Example2.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ async function delayedPow2(x) {
4444
return result;
4545
}
4646

47-
delayedPow1(10).then(v => {
47+
delayedPow2(10).then(v => {
4848
console.log(v);
4949
});
5050

51-
delayedPow2(10).then(v => {
51+
/* delayedPow2(10).then(v => {
5252
console.log(v);
53-
});
53+
}); */

4-Import&Export/Data2.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@
22
* Base exporting
33
*/
44

5-
const date = new Date();
5+
export const date = new Date();
66

7-
const add = (a, b) => {
7+
export const add = (a, b) => {
88
return a + b;
99
}
1010

11-
const sub = (a, b) => {
11+
export const sub = (a, b) => {
1212
return a - b;
1313
}
14-
15-
export {date, add, sub}

5-Arrays/Example4.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ const filterEBooks = () => {
1919
console.log(ebooks);
2020

2121
}
22-
23-
filterEBooks();
22+
filterEBooks();
23+
console.log(books);

5-Arrays/Example6.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ let numbers = [1, 2, 3, 4, 5];
1717
let addAllNumbers = () => {
1818
let acumulator = numbers.reduce ((curResult, element) => {
1919
return curResult + element;
20-
})
20+
},0)
2121

2222
console.log(acumulator);
2323
}

6-Rest&Spread/Example2.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,11 @@ const sortNumbersAndList = (...numbers) => {
1111
}
1212

1313
sortNumbersAndList(1, 3, 5, 6, 7, 2, 4);
14+
15+
let array = {name: ""};
16+
17+
for(let i = 0; i<5; i++){
18+
array = {name: "", ...array}
19+
}
20+
21+
console.log(array);

7-Destructuring/Example1.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@ const listFullnames = () => {
1313
//It pulls out only name and lastname, and assign them to both variables
1414
let {name, lastname} = element;
1515

16+
console.log(name);
17+
console.log(lastname);
18+
19+
1620
let fullname = `${name} ${lastname}`;
17-
return fullname;
21+
return {name, lastname};
1822
});
1923

2024
console.log(fullnames);

0 commit comments

Comments
 (0)