I am new to node and JavaScript. While going through a repository I found a snippet
const x = { ...JSON.parse(JSON.stringify(obj1)) };
I know that JSON.parse(JSON.stringify())
is used for cloning an object but what is the need of spread operator here?