Skip to content

Instantly share code, notes, and snippets.

@savelee savelee/ES2015-set.js
Last active Oct 7, 2016

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.size; //0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.