generated from oveland/react_vite_tailwindcss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharrowFunctions.js
48 lines (34 loc) · 1002 Bytes
/
arrowFunctions.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
function hello(name) {
console.log('Hola ', name);
}
const helloAnonima = function (name) {
console.log('Hola ', name);
};
hello('Olmer');
helloAnonima('Olmer con anónima');
(function (name) {
console.log('Hola ', name);
})('Desde llamado sin parámetro');
///////// Arrow functions
const helloA = (name) => {
console.log('Hola ', name);
};
helloA('Olmer desde AF');
const multiplicar = (a, b) => {
return a * b;
};
const resultado = multiplicar(3, 4);
console.log('RESULTADO ', resultado);
const multiplicarShort = (a, b) => a * b;
const resultado2 = multiplicarShort(3, 4);
console.log('RESULTADO SHORT', resultado2);
const names = ['Luis', 'Juan', 'Daniel'].map((n) => n.toUpperCase());
const names2 = ['Luis', 'Juan', 'Daniel'].map(function (name) {
return name.toUpperCase();
});
console.log(names);
console.log(names2);
/// Filter
const namesFiltered = ['Luis', 'Juan', 'Daniel'].filter((n) => n.includes('u'));
console.log('names filtrados', namesFiltered);
// Reduce