Instantly share code, notes, and snippets.

Embed
What would you like to do?
var settingsset = new Set([
[ 1, 'email'],
[ 2, 'url']
]);
settingsset.forEach(function (value, key) {
console.log(`Key: ${key} has value: ${value}`);
//Key: 1,email has value: 1,email
//Key: 2,url has value: 2,url
});
settingsset.size; //2
settingsset.add('username'); //Set [ Array[2], Array[2], "username" ]
settingsset.add({ devmode: true }); //Set [ Array[2], Array[2], "username", Object ]
settingsset.has('username'); //true
settingsset.delete('username'); //true
settingsset.has('username'); //false
console.log(settingsset); //Set [ Array[2], Array[2], Object ]
settingsset.clear();
settingsset.size; //0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment