var items = ['abc','pqr','abc','xyz','pqr','abc'];
var result = items.filter(UniqueElement);
//result ['abc', 'pqr','xyz']
function UniqueElement(value, index, self) {
return self.indexOf(value) === index;
}
function removeCC(s) {
/* Remove NewLine, Carriage Return and Tab characters from a String */
r = ""; for (i=0; i < s.length; i++) { if (s.charAt(i) != '\n' && s.charAt(i) != '\r' && s.charAt(i) != '\t') { r += s.charAt(i); } } return r; }
Same thing with regular expression
function removeCC(s){ return s.replace(/[\n\r\t]/g," "); }