JavaScript Objects as Hashes? Is the complexity greater than O(1)?

前端 未结 2 1551
醉酒成梦
醉酒成梦 2020-11-27 12:48

For some algorithm I was writing recently I thought that a hash would be excellent. I thought that I could probably just use the member variables in an object as key value p

2条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-27 13:30

    JavaScript objects are hashes. I cannot imagine any sane implementation that would not provide constant-time CRUD operations on object properties.

    Are you seeing specific performance issues with this approach?

提交回复
热议问题