<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                [TOC] ## 3.1 基本數據類型 * number * string * boolean * null * undefined ### typeof操作符可以判斷數據類型 ~~~ typeof 能識別基本類型,特殊null-->object 引用類型中function能識別 ~~~ ~~~ var a = 10; var str = "hello"; var c =ture; var obj = { age:18} console.log(typeof a); console.log(typeof str); console.log(typeof c); console.log(typeof obj) -->object ~~~ ### instanceof > java 中的instanceof 運算符是用來在運行時指出對象是否是特定類的一個實例。instanceof通過返回一個布爾值來指出,這個對象是否是這個特定類或者是它的子類的一個實例。 ``` var arr = [1,2,3,4]; console.log(Array.isArray(arr)); console.log(arr instanceof Array); ``` ## 3.2 引用類型 * array * function * json 對象 ### 3.2.1 array #### 3.2.1.1 定義數組 ~~~ var arr = [1,2,3]; ~~~ #### 3.2.1.2 數組屬性 ~~~ var arr=[1,2,3,4]; var len = arr.length; //length屬性,獲取數組的長度 console.log(len); //Tip:數組的下標從0開始 var value = arr[1]; //arr[index]-->讀取數組的值, arr[arr.length]=6; //arr[arr.length] -->向數組尾部添加值 console.log(arr); ~~~ #### 3.2.1.3 自定義數組屬性 ``` <script> Array.prototype.say=function(){ console.log("我是數組"); } var arr = new Array(1,2,3); arr.say(); </script> ``` ### 3.2.2 function > Tip:函數只有在調用后才執行 ~~~ //語法 function funcName(){ //coding程序塊 } ~~~ ~~~ function func(){ console.log("hello world"); } //函數只有調用才會執行 func(); ~~~ > 箭頭函數 ~~~ var test = () = >{ console.log("test"); } test(); ~~~ ### 3.2.3 json對象 * 1.聲明一個json對象 ~~~ var meili = { name : 'meili', age : 18 } //name 可以不寫雙引號,js自動補全 ~~~ * 2. 讀取對象屬性的值 ~~~ //讀取對象的值 console.log(meili.name); console.log(meili["age"]) ~~~ > Tip:在es6中倘若,json對象的屬性名和值相同,可以簡寫 ~~~ var name="chengchao"; var age=30; /* es5 */ var chengchao={ name:name, age:age } /* e6中倘若對象的屬性名和值相同可以簡寫 */ var zhang = { name, age } console.log(zhang.age); ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看