JSFiddle - React, Tailwind, and code Playground
by jfriend00
CSS
body {font-family: "Courier New"; font-size: 12px;}
JavaScript
var output = [
"Rose",
"India",
"Technologies",
"Rose",
"Ltd",
"India",
"Rose"
];
function removeDups(array) {
var index = {};
// traverse array from end to start so removing the current item from the array
// doesn't mess up the traversal
for (var i = array.length - 1; i >= 0; i--) {
if (array[i] in index) {
// remove this item
array.splice(i, 1);
} else {
// add this value index
index[array[i]] = true;
}
}
}
removeDups(output);
document.body.innerHTML = JSON.stringify(output);