How to implement Set of ES6 without using ES6

such as the title. If you implement ES6 built-in feature Set, without using other es6 API (such as Map)
if you want to write a Set that class imitates, should the underlying data structure use array or Object?

Mar.16,2021

  • if Key is a string, use Object
  • if it's any type, we have no choice but to use arrays, but. If the amount of data is large, the efficiency will certainly be relatively low
Menu