if statement in javascript always true

前端 未结 5 874
無奈伤痛
無奈伤痛 2020-12-11 18:54

So, I have the code, its not done, but all i want it to do is display one alert box if I write the word \'help\', and say something else if anything else is entered.

<
5条回答
  •  再見小時候
    2020-12-11 19:21

    Just change this: if (reply === 'help' || 'Help')

    To this: if (reply === 'help' || reply === 'Help')

    The or statement was not comparing the variable.

提交回复
热议问题