I searched a lot on the internet and didn't find any answer to solve my problem.
I have an object with several keys and values.
const replies = {
"Hello": ['Hi', 'Whats up', 'Aloha'],
"See you": ['Goodbye', 'exit']
};
My string is
Var sentence = "Hi my friend";
I would like a function that returns the key of "replies" if the "sentence" contains some value from it. Something like:
function search(replies, sentence){
var reply = sentence.includes(replies);
return reply //output is Hello key
}