js +与?优先级

 

var val = 'smtg';
console.log('Value is ' + (val === 'smtg') ? 'Something' : 'Nothing');

// A. Value is Something
// B. Value is Nothing
// C. NaN
// D. other

答案是D

输出

"Something"

 

posted @ 2019-04-20 15:04  anobscureretreat  阅读(286)  评论(0编辑  收藏  举报