메서드 삭제1 [JS] 자바스크립트 객체 프로퍼티 생성, 삭제 방법 # 프로퍼티/메서드 동적 생성 자바스크립트는 객체 생성이 완료된 후에도, 프로퍼티나 메서드를 추가할 수 있다. 1. 객체.신규key = 값 or 메서드 : 마침표(dot notation)를 이용해 신규 프로퍼티를 만들 수 있다. //myObj 객체 생성 var myObj = { prop_01: 1, method_01: function(){return 'func_01';} }; //prop_02 프로퍼티, method_02 메서드 생성 myObj.prop_02 = 2; myObj.method_02 = function(){return 'func_02'}; //생성 확인 console.log(myObj); /* { prop_01: 1, method_01: [Function: method_01], prop_02.. 2020. 10. 13. 이전 1 다음