How to avoid the top ten errors in JS

This error is the same as chrome’s “TypeError: ‘undefined’ is not a function”. It’s just that different browsers will report different error words. This kind of error is generally high on IE that uses namespaces. 99.9% it’s because IE can’t resolve the correct namespace that this points to. For example: var Person = { name : “daisy”, getName : function() { console.log(this.name) }, print: function() { this. getName() } }; For example, in the namespace of Person, the method this.getName() can be called in print. But it doesn’t work in IE, so the namespace must be clearly stated. var Person = { name : “daisy”, getName : function() { console.log(Person.name) }, print: function() { Person. getName() } }; (Note: Since I don’t have a Windows computer at hand, and I’m too lazy to find ==, so I haven’t verified it. According to the translation of the original text, I understand this meaning. If you are interested, you can verify it. Comments Tell me the conclusion~) 6. TypeError: ‘undefined’ is not a function This is the reason mentioned above, did Chrome/Firefox call it? The defined method leads to. I won’t go into details. Of course, except for negligence, no one will…

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索