ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 자바 스크립트
    프로그래밍 언어/데이터 타입 2011. 10. 3. 22:34
    undefined
    null
    String
    Boolean
    {true|false}

    * Creating A Namespace
    var MyLib = {}; // global Object cointainer
    MyLib.value = 1;
    MyLib.increment = function() { MyLib.value++; }
    MyLib.show = function() { alert(MyLib.value); }

    MyLib.value=6;
    MyLib.increment();
    MyLib.show(); // alerts 7

    *
    변수를 따로 선언할 필요 없다.
    ex. now = new Date();

    함수 내에 var를 쓰지 않으면 전역 변수로 취급


Designed by Tistory.