Javascript中的typeof() 与undefined 与undefined
生活随笔
收集整理的這篇文章主要介紹了
Javascript中的typeof() 与undefined 与undefined
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
直接看代碼:
console.log(typeof 42);// expected output: "number"console.log(typeof 'blubber');// expected output: "string"console.log(typeof true);// expected output: "boolean"var test;console.log(typeof test);// expected output: "undefined"console.log(test);// expected output: undefinedif(test != undefined){console.log("已定義")}else {console.log("未定義");// expected output: 未定義}if(typeof(test) != "undefined"){//typeof() 返回的值是字符串console.log("已定義");}else{console.log("未定義");// expected output: 未定義} typeof() 返回的值是字符串總結
以上是生活随笔為你收集整理的Javascript中的typeof() 与undefined 与undefined的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ArcGIS JS API 4.10跨域
- 下一篇: 基于ArcGIS JS API封装doj