[JavaScript] 객체 기본
IT/JavaScript 2020. 12. 31. 22:32

객체 : 관련된 데이터나 함수의 집합 객체 안에서는 데이터를 프로퍼티(속성), 함수를 메소드라고 한다. ​ let person = { name: ['Bob', 'Smith'], age: 32, gender: 'male', interests: ['music', 'skiing'], bio: function() { alert(this.name[0] + ' ' + this.name[1] + ' is ' + this.age + ' years old. He likes ' + this.interests[0] + ' and ' + this.interests[1] + '.'); }, greeting: function() { alert('Hi! I\'m ' + this.name[0] + '.'); } }; 이 예시에서 프..