That only works if the order of the keys maintains constant. This is not only not guaranteed within JavaScript, but has already been proven to cause issues earlier.
It might be a fluke that the solution you see passed when it was written. It's possible that an updated Node engine is more strict. I specifically expect an empty object with no keys if the input string is empty.
There is bug in tests, check my solution, if you create second Event object (e2=new Event;) it will get the same "private" data as first one. Btw is there any way to keep .prototype syntax and not get such behaviour ?
Yeah, you only ever need the last two cache entries.
That only works if the order of the keys maintains constant. This is not only not guaranteed within JavaScript, but has already been proven to cause issues earlier.
It might be a fluke that the solution you see passed when it was written. It's possible that an updated Node engine is more strict. I specifically expect an empty object with no keys if the input string is empty.
This comment is hidden because it contains spoiler information about the solution
Your code fails when dealing with an empty query string. Please read the output when submitting the code.
I don't know why it's failing on the example tests for me, but that used to work, and I haven't changed anything. I think it's a Codewars bug.
This comment is hidden because it contains spoiler information about the solution
Thanks. Changed it :)
global subscribed ? :)
There is bug in tests, check my solution, if you create second Event object (e2=new Event;) it will get the same "private" data as first one. Btw is there any way to keep .prototype syntax and not get such behaviour ?
This comment is hidden because it contains spoiler information about the solution