Notice
Recent Posts
Recent Comments
Link
«   2024/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
Tags
more
Archives
Today
Total
관리 메뉴

JS Coding

[JavaScript] JQuery 원리1 (기본구조) 본문

JavaScript

[JavaScript] JQuery 원리1 (기본구조)

JSKJS 2023. 11. 7. 11:35
<!DOCTYPE html>
<meta charset="UTF-8">
<script>
    // function 키워드가 함수/클래스 를 의미 !
    const myDom = function(pName){
        this.name = pName;

        /*
            여기에 선언하면 메모리가 낭비된다 ( 메모리가 많다면 가능)
       
        this.prt = function() {
            console.log("내 이름은 : ",this.name);
        };
        */
        return this;        // 클래스의 의미로 사용될땐 생략이 되어 있음.
    };

    // prototype 이란 것에 주목 해야 한다. 이것 때문에 자바스크립트를
    // prototype 객체지향 언어라고 부름
    myDom.prototype.prt=function(){
        console.log("이름 : ",this.name);
    }
        let ksh = new myDom("김석호");
        let kjs = new myDom("김재성");
        console.log("한번더 확인 : ",kjs);

        ksh.prt();
        kjs.prt();
   

</script>