There are lot of reasons . The main disadvantage is , JSON.stringify() converts Date objects to string. If the value of the key is undefined, when doing with JSON.stringify(), the key is lost. For example,
letobj1={date:newDate(),name:undefined}console.log(JSON.parse(JSON.stringify(obj1))// would return {date: "2021-05..." }
Notice that the name attribute(or key) is lost.
Also,, it causes performance issue. So developers prefer either JQuery or lodash to implement deep copy.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
There are lot of reasons . The main disadvantage is ,
JSON.stringify()
converts Date objects to string. If the value of the key is undefined, when doing withJSON.stringify()
, the key is lost. For example,Notice that the name attribute(or key) is lost.
Also,, it causes performance issue. So developers prefer either JQuery or lodash to implement deep copy.