Last active
March 8, 2017 04:08
-
-
Save channprj/7d680c6db8db18796978f9067e29380e to your computer and use it in GitHub Desktop.
Simple and naive implementation of array without duplicated items; Python set-like data structure written in JS. #help #wanted
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var jsSet = { item: 0 }; // use Object key as set item | |
item = 'setItem' | |
if (!(item in jsSet)) { // if item not in jsSet | |
jsSet[item] = 1; // save item with meaningless value | |
} | |
sessionStorage.setItem('jsSet', JSON.stringify(Object.keys(usages))) // save into sessionStorage |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment