본문 바로가기
javascript

this

by rami_ 2022. 2. 16.

dotnotation

function talk () {
	return `I am ${this.name}`
}

const me = {
	name : `rami`,
    age : 32,
    talk
}

const you = {
	name : `hey`,
    age : 1,
    talk
}

me.talk(); //I am rami
you.talk(); //I am hey

https://www.youtube.com/watch?v=fVXp7ZWjlO4

'javascript' 카테고리의 다른 글

Early Return  (0) 2022.02.27
Tree / Binary Search Tree  (0) 2022.02.26
prototype/__proto__  (0) 2022.02.05
closure  (0) 2022.02.02
Execute context  (0) 2022.02.02