-1

I am currently programming a simple chatbot but I getting trouble with the input identifier.

if (message.indexOf("how are you")>=0){
            send_message("Thanks, Iam good!");
            responsiveVoice.speak("Thanks, Iam good!");

Is person is tying in "How are you" the answer will not be triggered since its not lower case. I could copy/paste if state with "How" but is there a easier way? Please be gentle, aim new to programming. Thank you!

PXDN
  • 1
  • 2

2 Answers2

0

Use .toLowerCase()

if (message.toLowerCase().indexOf("how are you") >= 0)
Andrew Brooke
  • 12,073
  • 8
  • 39
  • 55
0

You could try toLowerCase function of javascript.

messaje.toLowerCase().indexOf("how are you")...

Function: http://www.w3schools.com/jsref/jsref_tolowercase.asp