Checking existence of properties in JavaScript

前端 未结 3 1428
北荒
北荒 2021-01-21 09:17

I\'m new to JavaScript and a little bit confused with the duck typing concept. As far as I can tell, I understood the concept. But that leads to a strange consequence in my thou

3条回答
  •  既然无缘
    2021-01-21 09:48

    Use try catch

    $('#canvas').live('vmousedown', function(e) {
       try {
           console.log(e.originalEvent.originalEvent.touches[0].webkitForce);
       } catch(e) {
           console.error('error ...');
       }
    }
    

提交回复
热议问题