Consider the below scenario
const searchString = 'Gen';
const myDict = {
'Genesis': 'You are the beginning',
'Joel': 'Joe is cool'
// Many other key value pairs
}
I need to get You are the beginning
because searchString(Gen
) is a substring of Genesis
.
How can I achieve this in an optimized way in JS?