this๊ฐ’๋ณ€ํ™”

call()์€ ์‹คํ–‰ํ• ๋•Œ๋งˆ๋‹ค ์–ด๋–ค ๊ฐ์ฒด์˜ this ๊ฐ’์„ ๋ฐ”๊พธ๋Š” ๋ช…๋ น! call()์€ ์ฒซ๋ฒˆ์งธ ์ธ์ž๋กœ๋Š” ๊ทธ ํ•จ์ˆ˜์— ๋‚ด๋ถ€์ ์œผ๋กœ this๋ฅผ ๋ญ˜๋กœ ํ• ์ง€ ์˜ค๊ณ , ๋‘๋ฒˆ์งธ ์ธ์ž๋ถ€ํ„ฐ๋Š” ํ˜ธ์ถœํ•˜๋ ค๋Š” ํ•จ์ˆ˜์— ์ธ์ž๊ฐ’(parameter)์ด ๋“ค์–ด์˜ค๊ฒŒ ๋œ๋‹ค // object ์™€ function ์‚ฌ์ด์˜ ๊ด€๊ณ„๋ฅผ ๊ทœ๋ช…ํ•ด๋ณด๊ธฐ 1 //์„œ๋กœ ์•„๋ฌด๋Ÿฐ ๊ด€๋ จ์ด ์—†๋Š” ๋‘ ๊ฐ์ฒด๋ฅผ ๋งŒ๋“ค์—ˆ์–ด์š”. let kim = {name:'kim', first:10, second:20} let lee = {name:'lee', first:10, second:10} function sum(prefix){ return prefix +(this.first + this.second); // ์–ด๋–ค ๊ฐ์ฒด์—๋„ ์†ํ•ด์žˆ์ง€ ์•Š์€ ํ•จ์ˆ˜ } //sum ์ด๋ผ๋Š” ๊ฐ์ฒด๋ฅผ ์‹คํ–‰์‹œํ‚ค๊ฒ ๋‹ค! consol..
becky(์ง€์€)
'this๊ฐ’๋ณ€ํ™”' ํƒœ๊ทธ์˜ ๊ธ€ ๋ชฉ๋ก