자바스크립트 함수사용법

(。◠ ◠。)·2022년 6월 6일
0

변수명.함수
ob.view(); 이렇게 불러서 사용하는게 특이한거같다.

 <script>
        function User(name, age){
            this.name=name;
            this.age=age;
            this.view=function(){
                document.write('나의 이름은'+this.name+'이고, 나이는 '+this.age+"살 입니다.<br>");
            };
        }

        var ob=new User('kim',25);
        var ob1=new User('lee',20);

        ob.view();
        ob1.view();


    </script>
profile
화이탱!

0개의 댓글

관련 채용 정보