Using JavaScript in Node.Js
v11, I encounter the problem, that I am trying to convert a string array (featuring duplicate entries) to a Set Object - in order to get rid of the duplicate entries - like this:
var arr = ["book", "author", "lines", "book"];
var unique = new Set(arr); //hoping for "book", "author", "lines" entries
console.log(JSON.stringify(unique)); //unique is empty!?
For some strange reason, my unique object remains empty after conversion. What am I missing?
EDIT: I marked an answer as well as approved a request to mark this a duplicated question due to the fact that my problem was not associtated with the result object being empty but using the wrong method to output its entries (JSON.stringify) as correctly pointed out by many contributors here.