jquery each loop array

for each loop

HTML

<script src="//www.addressfinder.co.nz/assets/v2/widget.js"></script>
<button class="btn btn-info" id="run1">Run Code</button>

JavaScript

$(document).ready(function() {
  $("#run1").click(function() {
    var arr = [1, 2, 4, 5, 6];
var str="4,2,8,9,3,7,6";
    $.each(arr, function(index, obj) {
      //We can access the object using obj or this
      if(str.match(obj)){
       alert("index:" + index + " , value: " + obj + " , value:" + this);
      }
     
    });

  });


});