Skip to content
Advertisement

Javascript find matched sentence with predefined words

Hello guys I need help to figure out an expression. I got phrases like

JavaScript

As you see above, target’s three words matches with last sentence. The purpose is to find sentence includes most matched words.

I did like

JavaScript

But it gives nothing

Advertisement

Answer

Use .filter(), .some(), .includes() and .sort() methods as explained below.

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement