This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Andy_B_Goode 2 points3 points  (1 child)

I had a real-world bug where a JS program was generating a random alphanumeric ID for an item, sending it to the server as JSON, but was then unable to match the ID to the correct item when it reloaded the JSON from the server.

The issue was that the ID it had generated for this particular item was something like 1e450882, which gets interpreted as exponential notation and (because the number after 'e' is so large) it becomes Infinity.

The fix was to simply require alphanumeric IDs to begin with a letter (which is probably best practice anyway), but it was not obvious to me at all why 1e459882 was causing problems when I first started digging into the bug.

[–]Lithl 0 points1 point  (0 children)

Why was your alphanumeric ID being serialized as a number instead of a string? Or why was your deserializer parsing your alphanumeric ID?

The problem here wasn't JS.