当问号?前表达式不满足时,需要运行两条语句。请问需要冒号:后要怎么写?
let s = document.getElementById('mainContent').style;
s.opacity = 1;
(function fade(){
(s.opacity-=.1)<0?s.display="none":{setTimeout(fade,100);console.log(123);}
})();
这样写会报错。只能用if-else了吗
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
用自执行匿名函数
用分号