Is there any kind of hash code function in JavaScript?

后端 未结 20 1181
慢半拍i
慢半拍i 2020-12-04 09:59

Basically, I\'m trying to create an object of unique objects, a set. I had the brilliant idea of just using a JavaScript object with objects for the property names. Such as,

20条回答
  •  眼角桃花
    2020-12-04 10:41

    In ECMAScript 6 there's now a Set that works how you'd like: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set

    It's already available in the latest Chrome, FF, and IE11.

提交回复
热议问题