title: Check array string and push string index to another variable Javascript
body: <p>Very new to Javascript and coding in general!</p>
  
  <p>I'm basically looking to test strings within an array, if and when a string returns a certain value I then want to get the index of that string within the array and store the indexes within another variable. </p>
  
  <p>The problem I'm having (I think) is that I'm unsure of the correct syntax to extract and push the index once I've confirmed that it's the string I'm looking for ... Apologies in advance if I've not explained myself very well.</p>
  
  <p>Here's what I have:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>let freightItems = ['contraband', 'clear', 'contraband', 'clear'];
  
  function scan(freightItems) {
  
    let contrabandIndexes = [];
    
    freightItems.forEach(str =&gt; {
      if (str === 'contraband') {
          freightItems.push(contrabandIndexes);
      }
    })
    
    return contrabandIndexes;
  }
  
  console.log(scan(freightItems))</code></pre>
  </div>
  </div>
  </p>