以下 JavaScript 代码输出结果正确的是__?

// 🎉 ✨ This is my 100th question! ✨ 🎉
const output = `${[] && 'Im'}possible!
You should${'' && `n't`} see a therapist after so much JavaScript lol`
995 次浏览
  • A、possible!Youshould see a therapist after so muchJavaScriptlol
  • B、Impossible!Youshould see a therapist after so muchJavaScriptlol
  • C、possible!Youshouldn't see a therapist after so much JavaScript lol
  • D、Impossible!Youshouldn't see a therapist after so much JavaScript lol
[]是⼀个真值。使⽤ &&运算符,如果左侧值是真值,则返回右侧值。在这种情况下,左侧值 []是⼀个真值,所以返回 Im。 ""是⼀个假值。如果左侧值是假的,则不返回任何内容。n't不会被退回
挑战成功
1年前
挑战失败
1年前
挑战成功
4年前

微信公众号

有课学公众号
  • 微信公众号: geekdaxue