If I want to get a value from the object know
but the case is different, it won’t match: "Hello"
won’t match "hello"
. Is there another work around for this?
function ct(e) {
var know = {
"Hi": "Hello",
"How are you?": "Great",
"Bye": "Have A Nice Day !",
"Hello": "Hi , Whats Up",
"What's your name?": "Claire Rachael"
};
let t = document.createElement("span");
t.setAttribute("class", "chatMessage left");
if (e in know) {
setTimeout(() => {
t.textContent = "Typing...";
d.appendChild(t);
g = d.getAttribute("data-bottom")
? d.getAttribute("data-bottom")
: 0;
if (parseInt(g) < 200)
d.scrollTo(0, d.scrollHeight);
}, 2000);
setTimeout(() => {
t.textContent = know[e];
d.appendChild(t);
g = d.getAttribute("data-bottom")
? d.getAttribute("data-bottom")
: 0;
if (parseInt(g) < 200)
d.scrollTo(0, d.scrollHeight);
else
alert("new message");
}, 6000)
}
else {
t.textContent = "I don't understand";
d.appendChild(t);
}
}