首页 > > > 《Javascript的小小疑问》
//------------------
//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/ ,如需转载,请注明出处,否则将追究法律责任。