//loops through the 'substr' array and performs an action //for each item inside of it var substr = [1, 2, 3, 4]; $.each(substr , function(index, val) { console.log(index, val) });