나의 성장과정  
Front Page
Tag | Location | Media | Guestbook | Admin   
 
오늘 배운것. (아래를 뭐라고 칭해야 할지 모르겠음)
<script type="text/javascript" language="javscript" src="prototype.js"></script>


Object.extend (String, {
  extendFunction : function(arg) { return arg;  }        
 });  

① 기능 : String 자체에 method추가
② 접근방법 : String.extendFunction('Love');
같은 방법 : String.extendFunction = function(arg) {  return arg;  }   


Object.extend (String.prototype, {
  extendFunction : function(arg) { return arg;  }        
 });  

① 기능 : String을 상속받는 객체에 method추가
② 접근방법 : var boram;  boram.extendFunction('Story');
같은 방법 : String.prototype.extendFunction = function(arg) {  return arg;  }   

각 프로퍼티 확인

var properties;

 for( properties in String ) {
   document.write(properties+'<br/>')
  }
                      document.write('---------------<br/>');
 for( properties in boram) {
   document.write(properties+'<br/>')
  }



prototype.js 에서  extend는 아래와 같이 정의되어 있다.

Object.extend = function(destination, source) {
  for (var property in source)
    destination[property] = source[property];
  return destination;
};

= 을 잘봐야 겠다.  언어에서 일반적인 의미가 아니라, 추가의 의미이다.




인생은 덧없이.


ㅎㅎ.... 퇴근길 지하철에서 가만히 생각해보니,,,, 이게 prototype 이네.. 
그동안 그렇게 궁금해왔던. 아.. 덧없어라.



BLOG main image
Simple is beatiful!
 Notice
 Category
분류 전체보기 (755)
전직 (0)
일상 (7)
진행중 (6)
3Fs (14)
미정 (3)
Serendipitous! (6)
지르자 : 맥북 (5)
(5)
FaceBook (3)
 TAGS
CP1215 DOM Eclipse primitive 사파리 Java JS tomcat HP JavaScript 자바스크립트 URL URLConnection color 접근지정자 laserjet 네트워크 Debug Safari 커피
 Calendar
«   2025/07   »
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
 Recent Entries
 Recent Comments
 Archive
 Link Site
상상할 수 있는 힘이 ..
즐겁게살자
인생의 소중한 꿈
{fly to the ocean.com}
누노의 컴퓨토피아
한RSS
[지인]I can\'t stop. Love. Lo…
[원츄]OK 괜찮아 다 잘 될거야
[원츄]애자일 이야기
[원츄]IBM Developerworks
 Visitor Statistics
Total :
Today :
Yesterday :
rss