Removing duplicates from array of strings in JavaScript

PHOTO EMBED

Sun Jun 07 2020 03:02:08 GMT+0000 (Coordinated Universal Time)

Saved 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_copyCOPY

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