输出什么?
javascript
// 🎉✨ This is my 100th question! ✨🎉
const output = `${[] && 'Im'}possible!
You should${'' && `n't`} see a therapist after so much JavaScript lol`A. possible! You should see a therapist after so much JavaScript lol B. Impossible! You should see a therapist after so much JavaScript lol C. possible! You shouldn't see a therapist after so much JavaScript lol D. Impossible! You shouldn't see a therapist after so much JavaScript lol
答案: B
解析:
[]是一个真值。 使用&&运算符,如果左侧值是真值,则返回右侧值。 在这种情况下,左侧值[]是一个真值,所以返回Im。 ""是一个假值。 如果左侧值是假的,则不返回任何内容。 n't不会被退回。