javascript中的undefined與is not defined


1.

var a;

console.log(a);

這里打印的是undefined;

2.

console.log(b);

這里瀏覽器會報錯,b is not defined;

3.

var c={};

consoloe.log(c.d);

這里也是打印undefined;這是訪問因為對象的不存在屬性,就會返回undefined.

總結:undefined 是不明確,不知道用來干什么的意思

        is not defined 是未定義的,瀏覽器會報錯

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM