Ad
  • Default User Avatar

    You probably don't need the answer as of now. You might not even see this comment. But to anyone who is interested in the explanation, here it is:

    Storing an object as a key inside of an another object doesn't really work. Object keys in javascript are type of String (Even when you access a property of an object using a number i.e. obj[1] javacsript internally converts it to a String type). And since keys in an object should be of type string any object that is used as a key inside of another object will be turned into "[object Object]". That's why the check on line 4 fails to distinguish the other objects. The solution should work with maps though. Unlike in objects, you can use objects as keys in maps. For additional info on maps: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map

  • Default User Avatar

    Because it's a "polyfill" of ES6's built-in BigInt class