Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Javascript supports Sets?

Does Javascript supports Sets(list with unique objects only) ?

I have found this link, but from what I remember foreach in JS in not supported by every browser.

like image 231
IAdapter Avatar asked Dec 27 '10 14:12

IAdapter


Video Answer


1 Answers

Are your keys strings?

Every JavaScript object is a map, which means that it can represent a set.

As illustrated in the page you mentioned, each object will accept only one copy of each key (attribute name). The value for the key/attribute doesn't matter.

like image 101
Joshua Fox Avatar answered Sep 18 '22 00:09

Joshua Fox