Javascript: Text Search Function

myName = 'trousers';
text = 'In Scotland, trousers are occasionally known as trews, which is the historic root of the word trousers. Trousers are also known as breeks in Scots, a word related to breeches. The item of clothing worn under trousers is underpants. The standard form trousers is also used, but it is sometimes pronounced in a manner approximately represented by [ˈtruːzɨrz], as Scots did not completely undergo the Great Vowel Shift, and thus retains the vowel sound of the Gaelic truis from which the word originates. In North America, Australia, South Africa and Northern England[citation needed] pants is the general category term, whereas trousers (sometimes slacks in Australia and the United States) often refers more specifically to tailored garments with a waistband, belt-loops, and a fly-front. So informal elastic-waist knitted garments would be called pants, but not trousers (or slacks).';
hits= [];

for (i = 0; i <= text.length; i++) {

    if (text[i] === myName.substring(0, 1)) {

        for (j = i; j <= i + myName.length; j++) {