Javascript arrays can contain duplicates - which is fine most of the time, but can sometimes cause some issues. For example, if an array is supposed to only contain unique user IDs, but is taken from a data source that may contain duplicates: let userIds = [ '123-123', '123-123', '234-234', '345-345' ] In these cases, it can seem quite difficult to get only unique values. Is the best way to check every value against every other value in an array? That seems like a lot of work. Fortunately, there is an easy way to make a unique array - using . javascript sets A set can only contain unique values, so passing your array into a constructor will produce one set with unique values: new Set() let userIds = [ '123-123', '123-123', '234-234', '345-345' ] let uniqueUserIds = new Set(userIds) console.log(uniqueUserIds) // Set(3) {'123-123', '234-234', '345-345'} While sets have their own methods and these are described in , sometimes arrays can be both more familiar and have more useful methods. my set guide here To convert your set back to an array, use the method: Array.from() let userIds = [ '123-123', '123-123', '234-234', '345-345' ] let uniqueUserIds = new Set(userIds) let arrayUserIds = Array.from(uniqueUserIds) console.log(arrayUserIds) // [ '123-123', '234-234', '345-345' ] Now you have a perfectly unique set of array items - and you won't have to worry about processing times or inaccuracy. Also published . here