programming/javascript
JS) call 예제
FaustK
2019. 2. 4. 12:57
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | //자바스크립트 함수, call const rose = {name : "로즈-장미"}; const lily = {name : "릴리-백합"}; const mugunghwa = {name : "무궁화-무궁화"}; function flower(){ return `flower : ${this.name}`; } console.log(flower.call()); // flower : console.log(flower.call(lily)); // flower : 릴리-백합 function updateFlower(languge, japanese){ this.languge = languge; this.japanese = japanese; } updateFlower.call(rose, '사랑', 'バラ'); updateFlower.call(lily, '순결', 'ユリ'); updateFlower.call(mugunghwa, '끈기', 'ムクゲ'); | cs |
이선 브라운 "러닝 자바스크립트" 6.8 call 예제 응용해보기