TIL
클로저
은지:)
2023. 5. 19. 17:54
728x90
반응형
const order = (food) => {
return (drink) => console.log(`음식 : ${food}, 음료 : ${drink}`)
}
let a = order("밥")
a("콜라")
a("사이다")
class Car {
constructor(name,price){
this.name = name
this.price = price
this.place = "판교현백"
}
applyDiscount(discount) {return this.price*discount}
changePlace(placeName) {return this.place = placeName}
}
const instance = new Car("EUNJI",2000)
const ab = () => {
instance.changePlace("판교")
console.log(instance)
}
ab()
++ 추가 예정
728x90
반응형