Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有时我会收到类似错误的错误。为什么会出现?
如果您尝试访问未定义值的属性,就会发生这种情况。例如:
var test; // test is now undefined, typeof(test) would return "undefined" test.myPropertyName // => throws 'Uncaught TypeError: Cannot read property 'undefined' of undefined'
因此,听起来您正在尝试使用未初始化的变量执行操作。