0

how to solve the javascript case sensitive problem ?

Javascript case sensitive problem like if i put "I am fine" as a user then i just put "fine" in my bot it says error in the user

4th Jul 2020, 5:28 AM
Felicity
Felicity - avatar
13 ответов
+ 8
That is unexpected behavior. Imma gonna have to do some experimentations on this. 😉 Thanks for sharing.
4th Jul 2020, 3:56 PM
David Carroll
David Carroll - avatar
+ 7
Can confirm; I am also getting "1" as the output rather than "true". Even if I do "console.log(Boolean(1))", it still gives "1" and not "true". Edit: console.log(1==true); // 1 console.log(1===true); // 0 console.log(Boolean(1)===true) // 1
4th Jul 2020, 8:21 AM
Russ
Russ - avatar
+ 6
Code Crasher Those output as boolean "true" values on my Android. Are you getting integer 1 as the output from iOS?
4th Jul 2020, 7:00 AM
David Carroll
David Carroll - avatar
+ 5
var f = "I'm fine".includes('fine'); console.log(f); // true f = "fine".includes('fine'); console.log(f); // true f = "I'm not fine".includes('fine'); console.log(f); // true
4th Jul 2020, 6:15 AM
Calviղ
Calviղ - avatar
+ 2
Before passing the text input to evaluation by the bot, first do a case change, i.e, to lower case or upper case depending on what case the bot requires. If it needs uppercase input, then let input = uInput.toUpperCase(); Or if its lower case needed then let input = uInput.toLowerCase(); Happy coding ☺ Keep coding 🙏🏾
4th Jul 2020, 5:54 AM
Alfred Juma
Alfred Juma - avatar
+ 2
thanks for your answer code crasher
4th Jul 2020, 6:58 AM
Felicity
Felicity - avatar
+ 2
i think regex with i flag is also an alternative for you (if you know)
5th Jul 2020, 2:50 PM
Divya Mohan
Divya Mohan - avatar
+ 1
how about search sensitive?
4th Jul 2020, 5:56 AM
Felicity
Felicity - avatar
+ 1
Ellaborate further please
4th Jul 2020, 5:58 AM
Alfred Juma
Alfred Juma - avatar
+ 1
if user said i am a friend of yours even if i put friend at the user input it still says i dont understand...
4th Jul 2020, 6:10 AM
Felicity
Felicity - avatar
+ 1
thanks to the two of you
4th Jul 2020, 6:25 AM
Felicity
Felicity - avatar