how to solve the javascript case sensitive problem ? | SoloLearn: Learn to code for FREE!


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


7/4/2020 5:28:21 AM


13 Answers

New Answer


That is unexpected behavior. Imma gonna have to do some experimentations on this. 😉 Thanks for sharing.


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


Code Crasher Those output as boolean "true" values on my Android. Are you getting integer 1 as the output from iOS?


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


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 🙏🏾


Calviղ other than debugging and logging, what is the purpose of using the console for output? It is not always available in the iPhone app and takes up 1/4 of the screen, so I am glad it is not often used. And does the Android app really output "true" in your code example, or does it output "1" like the iPhone app? I realize effectively they are the same, just different representation, but I am still curious. 😉


thanks for your answer code crasher


David Carroll yep. integers. That is why I asked. curious?


i think regex with i flag is also an alternative for you (if you know)


how about search sensitive?


Ellaborate further please


if user said i am a friend of yours even if i put friend at the user input it still says i dont understand...


thanks to the two of you