cm0002@lemmy.world to Programmer Humor@programming.dev · 4 个月前JavaScriptlemmy.mlimagemessage-square158fedilinkarrow-up11.06Karrow-down115cross-posted to: programmerhumor@lemmy.ml
arrow-up11.04Karrow-down1imageJavaScriptlemmy.mlcm0002@lemmy.world to Programmer Humor@programming.dev · 4 个月前message-square158fedilinkcross-posted to: programmerhumor@lemmy.ml
minus-squaregrue@lemmy.worldlinkfedilinkarrow-up4·4 个月前Which “1” did it remove? And did it search the string to find a “1” to remove, or did it remove whichever character happened to be at array index 1?
minus-square⛓️💥@sh.itjust.workslinkfedilinkEnglisharrow-up12·4 个月前The one at the end. Subtraction is the opposite of addition. If addition adds a character to the end of the string, it must follow that subtraction would remove a character from the end of the string.
minus-squareFooBarrington@lemmy.worldlinkfedilinkarrow-up4·4 个月前It should just randomly pick any “1”. Add a bit of spice, you know
Which “1” did it remove? And did it search the string to find a “1” to remove, or did it remove whichever character happened to be at array index 1?
The one at the end. Subtraction is the opposite of addition. If addition adds a character to the end of the string, it must follow that subtraction would remove a character from the end of the string.
This is how we end up with an endian schism
It should just randomly pick any “1”. Add a bit of spice, you know
maybe we removed the last n characters