This day, the company’s front-end program ape Xiaoming is eating hot pot singing, happily with the back end of the development of xiaogang interface. The page is also not difficult, in the personal space to display a history list, and then each item of the list can be corresponding to the operation. Something like this:
Xiaoming across the station to the opposite xiaogang shouted: “your download interface has a problem!”
Xiao Ming’s words offend Xiao Gang’s dignity as a backend, Xiao Gang suppressed a flash of multiple thoughts — “your environment is the problem”, “** do you know how to use”, patiently checked his logic, replied: “There is no problem, you give me the ID”.
Xiaoming throws a string of numbers 76154831290589340 from the internal IM. The id generation is random, as chaotic as this bug.
Small just: “you this ID does not exist in storehouse.”
Xiao Ming: “how possible, you returned to me.”
Small gang: “nonsense, WHAT I give you is clearly 76154831290589341.”
…
Two hundred words of mutual bickering are omitted here.
Next thing you know, the two of them sit down together amicably and witness the miracle.
Xiaoming: “you see, this is the network request return, ah, wait, why end is 41?” (Slap in the face)
Ming tries to continue struggling: “No, look at the rendered page, what the heck.”
During the operation, Xiao Ming accidentally clicked the Preview bar of the development tool Network, and a more bizarre phenomenon appeared:
It’s the same request, but Preview is different from Response. This is because of the distortion of morality or the decline of humanity! ? Xiao Ming could not help thinking.
Watching for a long time, Xiao Gang said, “I have a bold idea.” So he took the page console and typed out an expression so startling that it overturned the foundations of modern mathematics. (false)
At this point things get easier because the back end defines the ID type as long, so the number is not out of range in the back end’s eyes. In Javascript, however, inaccuracies occur when large integers of type number exceed 2 to the power of 53 (9007199254740992). The solution is also very simple, change the response to return string.
With the end of “Approaching Science”, Xiao Ming and Xiao Gang gradually calmed down and returned to their daily development. The sun slanted in and the station was golden. Other friends in the group are working hard to build a smart cloud platform.
A programmer from Youdao Zhiyun: Ai.Netease