Check If a Word Occurs As a Prefix of Any Word in a Sentence

Given a sentence s and a searchWord sw, return the index of the word in the sentence where the searchWord is a prefix of this word. If the searchWord is a prefix of more than one word, return the index of the first word.

Ada AI

I want to discuss a solution

Help me solve this

Give more examples

What's wrong with my code?

How to use 'for loop' in javascript?