Shallow clones versus structured clones
07-Jan-2025 58
Have you ever had one of those times when you think you’re doing everything right, yet still you get an unexpected bug in your application? Particularly when it is state-related and you thought you did everything you could to isolate the state by making copies instead of mutating it in place.
Especially when you are, say, building a game that copies a blank initial state when you create a new room and, no matter what you do, you still find that every player is in every room.
Shallow clones versus structured clones #js #javascript #Shallow #clones #versus #structured #clones https://javascript.ba/link/shallow-clones-versus-structured-clones