开发者

handling javascript object existence checks globally

开发者 https://www.devze.com 2023-02-27 00:14 出处:网络
My JS developers always miss checking the object existence causi开发者_如何学Pythonng doucument.getElementByID is null problem. is there a way to handle this globally than adding the check for every s

My JS developers always miss checking the object existence causi开发者_如何学Pythonng doucument.getElementByID is null problem. is there a way to handle this globally than adding the check for every single object. or is it possible to handle/suppress it during runtime?


Beat your developers with a "Javascript for Dummies" book and then make them go back and fix their code.

Seriously.

Error suppression can seem like a good thing at first, but it'll haunt you later down the road.


Suppress all errors:

window.onerror = function(){return true;};

But you may want to really should handle errors in a more decent fashion.

0

精彩评论

暂无评论...
验证码 换一张
取 消