-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharrowFn.js
More file actions
47 lines (33 loc) · 788 Bytes
/
arrowFn.js
File metadata and controls
47 lines (33 loc) · 788 Bytes
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
//Funciones con la palabra reservada function
function Fn(){
this.nombre = 'Juan'
this.apellido = 'Rivera'
}
Fn.prototype.lala = function prototype(){}
const r = new Fn();
//console.log(r.__proto__);
//------------------------------------------------------------
// fat arrow function
//console.log(this);
const fatFn = () => { //No tienen contexto
const obj = {}
this.prop = 'propiedad';
obj.prop = 'propiedad obj'
return obj;
}
const r1 = fatFn();
//console.log(this);
//console.log(r1);
//-------------------------------------------------------------
//Return implicito
const fnR = () => 2
//console.log(fnR());
const hol = function (){
this.holita = 'holita'
console.log(this);
}
const hol2 = ()=>{
console.log(this);
}
hol();
hol2();