Find first occurrence of a string in a String array in Typescript/Javascript : <p>I have an empty string array. I push into it new strings, and I do this one by one. Then, it will happen that the string I'm pushing is already in the array, and I want to find the index of that original string and split the array in the range:</p>

<p><code>[start, index_of_firstString]</code>.</p>

<p>So if we have:</p>

<pre><code>myArray: string[] = [];

function(myString: string) {
this.myArray.push(myString);
}
</code></pre>

<p>What could be a good solution? I need to check for duplicates every time I push a new string.</p>
