JSFiddle - React, Tailwind, and code Playground
by yokano
HTML
<div id="src"></div>
<div id="result"></div>
JavaScript
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());