Can anyone explain to me what is the difference between these two statements and why the second one does not work and the first one does:
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;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With