Hi everybody, today I am going to show examples of few important Javascript functions.
DEEP COPY
JavaScript allows you to deep copy an ...
For further actions, you may consider blocking this person and/or reporting abuse
You should not use JSON.stringify to clone object. It leads to problems because it can't strinigfy functions,symbol etc.
Just use lodash. Or write your own deep cloning algo. Or when using the browser you can use structuredClone (there are some limits too).
Node.js 17.0.0 added structuredClone(value[, options])
Before that use v8.serialize(value) and v8.deserialize(buffer).
Then there is flatted which adds recursive references and
RecursiveMap
on top of JSON (still no functions, symbols, etc.).noted. thanks
noted. thanks
"And you can google any of these if needed." reading relaxed me instantly.
wow, thanks, it's really helpful for me :)
Thank you and I would like to add, that creating a clone with JSON object (with parse and stringify) has some limitations! It will not work with every object.
It's also important to remember that
JSON.stringify
cannot copy functions, so the "deep copy" only works for regular data types and objects.hhahahhahah. what work, works
love that reply, thank u.
These seem useful. Thanks for posting!
you are welcome
That's good too hear. I like your attitude. No offense. Might have misread your comment.
There is some typos. Like DECTECT , Andriod, prama, visiabilty.
The "Wait" function is wrong. Please see @luke shiru's comment.
Bro, you're a bit harsh. Though I would agree that title looks like a clickbait.
I dont mind criticism. Its ok
You're opened minded. Much respected!