+ 1

How can I get my desired output, when a keyword matching to the condition is entered? What function should I use?

8th Apr 2019, 12:13 PM
Piyush Kumar
Piyush Kumar - avatar
4 Respostas
+ 2
Triggerring an action just with the keyword 'time' will lead to many bugs. The suggestion I can give is use regex. For example.you can use this inside an if statement. if(/^what?( is)?( the?) time+$/gi.test(YOUR_INPUT)) { //TODO here } You can add more and more rules to make it more accurate. Just helping you to get started with
8th Apr 2019, 1:25 PM
Seniru
Seniru - avatar
+ 3
https://code.sololearn.com/W2Qs9Zjs1qa3/?ref=app This could be helpful. You have use the regural expressions for pattern matching and searching elements.
8th Apr 2019, 1:55 PM
Deepak
Deepak - avatar
+ 2
Like what, can you give the example?
8th Apr 2019, 1:04 PM
Deepak
Deepak - avatar
0
For example. If i am to get the output of "What is the time?", How can I get the same output using just the keyword "time"?
8th Apr 2019, 1:07 PM
Piyush Kumar
Piyush Kumar - avatar