Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

Recent questions tagged 不使用三元运算符和

0 votes
997 views
1 answer
    RT,维护一个老项目,经常看到这种垃圾代码,有没有比三元运算更优雅的实现呢 // 比如说变量a有1和2两个值,当它初始为1则赋值2,初始为2则赋值1 let a = 1 // 垃圾1 if (a == 1) { a = 2 } else { a = 1 } // 优雅1 a = a == 1 ? 2 : 1...
asked Jan 27, 2021 in Technique[技术] by 深蓝 (71.8m points)
0 votes
1.1k views
1 answer
    RT,维护一个老项目,经常看到这种垃圾代码,有没有比三元运算更优雅的实现呢 // 比如说变量a有1和2两个值,当它初始为1则赋值2,初始为2则赋值1 let a = 1 // 垃圾1 if (a == 1) { a = 2 } else { a = 1 } // 优雅1 a = a == 1 ? 2 : 1...
asked Jan 27, 2021 in Technique[技术] by 深蓝 (71.8m points)
To see more, click for the full list of questions or popular tags.
Ask a question:
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...