Stop if statement when condition is met
<p>I'm displaying the <strong><em>first</em></strong> value that is <code>&gt;= 5</code> out of an array of random numbers spanning 0-10. I'm currently using <code>event.stopPropagation();</code> to end the function so the <code>span</code> isn't replaced by the final <code>data.val &gt;= 5</code>. While this works just fine, it's throwing a console error: <code>Cannot read property 'stopPropagation' of undefined</code></p>

<p>Is there something I'm doing wrong here? Is there a better way to tackle this?</p>

<pre><code>function numbers(data) {
  if (data.val &gt;= 5)  {
    $('span').html(data.val);
    event.stopPropagation(); 
  }
}
</code></pre>