0 points

Removing duplicates from array of strings in JavaScript


dashboard

Sun Jun 07 2020 03:02:08 GMT+0000 (UTC)

Posted by @biranchi125 #javascript

let old_arr = ["A", "A", "B", "C", "D", "E", "F", "F"]
let new_arr = [...new Set(old_arr)];

new_arr
["A", "B", "C", "D", "E", "F"]

content_copy Copy

This code removes duplicate strings from an array of strings. The new Set() method removes the duplicates from the list of strings.