Uncaught TypeError:无法读取未定义的属性'1' [英] Uncaught TypeError: Cannot read property '1' of undefined

查看:185
本文介绍了Uncaught TypeError:无法读取未定义的属性'1'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图摆弄一个应用程序,得到这个错误Uncaught TypeError:无法在开发工具控制台中读取未定义的属性'1'。我很确定这是因为我拉的JSON,我使用的代理不能正确对话。严肃的问题,我真的不明白文件中发生了什么。我也看到有很多这样的类似问题,所以我猜测他们是非常本地化的,并不适合社区。尽管如此,我仍然对我很重要,我想知道代码中发生了什么,而不仅仅是解决问题。你可以在这里查看: http://dev.bowdenweb.com/busfinder.html 我确实把它放在jsfiddle上,但它没有正确渲染。感谢任何和所有的建议!

解决方案

loadBusesIntoMap 似乎是问题的根源。在Chrome开发人员工具上,单击错误旁边的箭头并跟踪堆栈。在运行谷歌地图代码之前,抛出错误的函数就是其中之一。很可能是某个地方发送了一个空的 bus 数组。我首先检查它是空的还是先有一个长度 ...


trying to fiddle with an app, getting this error "Uncaught TypeError: Cannot read property '1' of undefined "in dev tools console. i'm pretty sure it's because of the json i'm pulling and the proxy i'm using are not talking to each other correctly. seriously n00b question, i truly don't understand what's going on in the document. i also see that there are ALOT of similar questions like this, so i'm guessing they're pretty localized and not great for the community. still important to me though...i'd like to learn what's going on in the code, not just fix the problem. you can check it out here: http://dev.bowdenweb.com/busfinder.html i did put it up on jsfiddle, but it wasn't rendering correctly. thanks for any and all advice!

解决方案

loadBusesIntoMap seems to be the root of the problem. On Chrome developer tools, click on the arrow next to the error and track the stack. Just before running Google maps code the function that throws error is that one. It's very probable that somewhere you're sending an empty buses array. I'd start by checking if it's empty or has a length first...

这篇关于Uncaught TypeError:无法读取未定义的属性'1'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆