Javascript
-
[JS] 자바스크립트의 객체Javascript 2021. 7. 27. 10:49
자바스크립트의 객체 생성방법 변수 = {}; 로 정의 var 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] + '.'); } }; 그 안에 프로퍼티를 입력할 경우에는 : 을 사용해서 객체의 프로퍼티를..