js三元运算符? :

this.color = 'red' ? 'blue' : 'red'
this.color永远为 'red,因为'red' ? 'blue' : 'red'永远为‘red’
 
 
 
this.color = this.color ==='red' ? 'blue' : 'red'
this.color会根据 this.color ==='red' ? 'blue' : 'red'的值动态变化
posted @ 2021-07-04 16:44  绣幕  阅读(55)  评论(0编辑  收藏  举报