@ycmjason/

What is this?

Nodejs

No description

fork
loading
Files
  • index.js
index.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
'use strict';

const magic = function() {
	// a. what is `this`?
  console.log(this);
	const cool = () => {
		// b. what is `this`?
    console.log(this);
	};
	cool();
};

// QUESTION 1
magic();


// QUESTION 2
const apple = { name: 'apple' };
apple.magic = magic;
apple.magic();

// QUESTION 3
const orange = { name: 'orange' };
magic.call(orange);
node v10.16.0