Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 |
Tags
- Java
- 국제화
- OGNL
- JavaScript
- paint
- 생성자
- 안드로이드
- mybatis
- 기본
- Menu
- 오버로딩
- HTML
- AWT
- Android
- JSP
- layout
- 클래스
- 에러페이지
- 어노테이션
- struts2
- Eclips
- oracle
- 전화걸기
- 이클립스
- Graphic
- 예외처리
- Spring
- 메소드
- 메서드
- 배열
Archives
- Today
- Total
note
동적으로 메서드 추가 본문
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script>
//변수를 선언합니다.
var student= {};
student.이름 = '윤인성';
student.취미 = '악기';
student.특기 = '프로그래밍';
student.장래희망 = '생명공학자';
// to String() 메서드를 만듭니다
student.toString = function(){
var output ='';
for(var key in this){
//toString()메서드는 출력하지 않게합니다.
if(key != 'toString'){
output += key + '\t' + this[key] + '\n';
}
}
return output;
};
//출력합니다
alert(student.toString());
</script>
</head>
<body>
</body>
</html>