var b = 1,c; if(typeof a !== 'undefined') { console.log('a exists!') } else { console.log('a does not exists!') } if(typeof b !== 'undefined') { console.log('b exists!') } else { console.log('b does not exists!') } if(typeof c !== 'undefined') { console.log('c exists!') } else { console.log('c does not exists!') } //已定义但没有赋值或者没有定义