const article = {
title: 'How to Use the Spread Operator (...) in JavaScript',
claps: 1000000,
author: {
name: 'Juan',
publication: 'LiveCodeStream'
}
}
const articleCopy = { ...article }
articleCopy.title = 'Strange behaviours with spread operator and deep copy';
articleCopy.author.name = 'JC';
console.log('Original title:', article.title);
console.log('Original author:', article.author.name)
console.log('Copy title:', articleCopy.title)
console.log('Copy author:', articleCopy.author.name)
This Pen doesn't use any external CSS resources.