var src = ['apple', 'orange', 'apple', 'banana', 'orange', 'orange']; var removeDuplication = function(array) { var result = []; array.forEach(function(element) { if(result.indexOf(element) == -1) { result.push(element); } }); return result; }; var result = removeDuplication(src); $('#src').html(src.toString()); $('#result').html(result.toString());
<div id="src"></div> <div id="result"></div>