galaxy brain code from work today :marseymindblown::taymindblown:

!codecels

46
Jump in the discussion.

No email address required.

Javascript is so cringe lol, you see that json stringify/parse thing everywhere for cloning objects because it's either that, importing fricking jquery (ick) or writing your own custom clone script for every use case

Shit-tier language for shit-tier devs (webcels)

Jump in the discussion.

No email address required.

>Javascript is so cringe lol, you see that json stringify/parse thing everywhere for cloning objects because it's either that, importing fucking jquery (ick) or writing your own custom clone script for every use case

bb the fuck u talm bout jquery. 💀💀 dumbass redditor hahaha 😭😭 blamin ur tools every time u talk code ur so smug and wrong lmaooo!! nigga watch me clone that shit in 1 line

const clonedObj = {...obj1};

!codecels look at this queef cake :taylaugh:

Jump in the discussion.

No email address required.

I think he means deep cloning (I would not know, as I am not a webshit).

Jump in the discussion.

No email address required.

Who needs to deep clone shit these days?

Jump in the discussion.

No email address required.

Deep cloning considered harmful: mutation is evil, chud!

Jump in the discussion.

No email address required.

that is a deep clone it copies the fields. obj2 = obj1 makes a shallow copy.

Jump in the discussion.

No email address required.

obj1 = obj2 is assignment (does not copy anything), obj1 = {...obj2} is shallow copying, obj1 = JSON.parse(JSON.stringify(obj2)) is deep copying. :marseyretard3:

Jump in the discussion.

No email address required.

:#marseywtf:

Neighbor I sure as heck hope you aint getting paid as a js dev

But then I remember is-odd exists

Jump in the discussion.

No email address required.

javascript does suck tho

Jump in the discussion.

No email address required.

I don't think destructuring assignment on its own would create a deep copy.

Jump in the discussion.

No email address required.

Oh, that's what it's for. It's extra r-slurred in this case tho because it starts with an object literal except it's a string literal. Also it doesn't work because of that.

Jump in the discussion.

No email address required.

Who uses jquery in 2023?

Jump in the discussion.

No email address required.

Jump in the discussion.

No email address required.

:marseythumbsup:

Jump in the discussion.

No email address required.

Lodash too

Jump in the discussion.

No email address required.

Link copied to clipboard
Action successful!
Error, please refresh the page and try again.