let my = {'aa':1,'bb':2,'cc':3,'dd':4}[data];
data等于'aa'时,my为1
aa && console.log('1');
aa为true输出1
bb || console.log('2');
bb为false输出2
let my = {'aa':1,'bb':2,'cc':3,'dd':4}[data];
data等于'aa'时,my为1
aa && console.log('1');
aa为true输出1
bb || console.log('2');
bb为false输出2
转载于:https://www.cnblogs.com/kevinmajesty/p/10857869.html