+ 1
How can I get my desired output, when a keyword matching to the condition is entered? What function should I use?
4 Respuestas
+ 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
+ 3
https://code.sololearn.com/W2Qs9Zjs1qa3/?ref=app
This could be helpful.
You have use the regural expressions for pattern matching and searching elements.
+ 2
Like what, can you give the example?
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"?