// remove duplicate value from string let str = "a b a"; let words = str.toLowerCase().split(" "); const remDuplicate = words.filter((data,index,src)=>{ return src.indexOf(data)===index }) console.log("remDuplicate =>",remDuplicate)