学无止境,加油屌丝

2021-12-1

或运算符练习

https://blog.csdn.net/kuafu888/article/details/121666845

 

与运算练习

https://blog.csdn.net/kuafu888/article/details/121667103

 

 

 三元运算符

1 // 三元运算符
2     var a = 9;
3     console.log(a.toString()[1]); //第0位为9 ,第1位为undefined
4     console.log(a.toString()[1] ? a : '0'+a);
5     // 三元运算符,如果第一位为真,则直接输出a,否则输出a前面加0,做月份判断的,10以内前面加0

 

posted @ 2021-12-01 22:48  nofeel666  阅读(25)  评论(0编辑  收藏  举报