任何人都可以向我解释这两个陈述之间有什么区别,以及为什么第二个陈述不起作用,第一个陈述不起作用:
if (finalWord.length > 140) return false; else return finalWord;
(finalWord.length > 140) ? false : finalWord;
It looks, you miss the return
statement .
return finalWord.length > 140 ? false : finalWord;
You could shorten it to
return finalWord.length <= 140 && finalWord;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.