ITPub博客

首页 > > > 《Javascript的小小疑问》

《Javascript的小小疑问》

作者:古月雪 时间:2019-09-11 15:51:34 0 删除 编辑
//------------------
//1
//------------------
 console.log(_arr[len-1].length); //Cannot read property 'length' of undefined ???

//------------------
//2
//------------------
if(undefined !== _arr[len-1] && _arr[len-1].length){
            console.log(_arr[len-1].length); //2      
};

第二行就行,why

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/3711/viewspace-3128865/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-07-09

  • 博文量
    160
  • 访问量
    1174