let a:string = 'wertyuiolgfdsxcvbnm';
function(){
try{
// localStorage有时会undefined
if(localStorage){
token = localStorage.getItem('token')
}
}catch(error){
token = token
}
console.log(token)
}
提问:当localStorage为undefined时,为什么在catch抛出错误时,token零时变量的值不是localStorage.getItem('token')的值,而是默认初始值