TG Telegram Group & Channel
JavaScript | United States America (US)
Create: Update:

CHALLENGE

const teams = [
{ name: 'Warriors', players: ['Curry', 'Thompson'] },
{ name: 'Lakers', players: ['James', 'Davis'] }
];

const newTeams = JSON.parse(JSON.stringify(teams));
newTeams[0].players.push('Green');

const shallowCopy = [...teams];
shallowCopy[1].name = 'Clippers';

const freezeTest = Object.freeze({nested: {value: 42}});
freezeTest.nested.value = 100;

console.log(teams[1].name, teams[0].players.length, freezeTest.nested.value);

CHALLENGE

const teams = [
{ name: 'Warriors', players: ['Curry', 'Thompson'] },
{ name: 'Lakers', players: ['James', 'Davis'] }
];

const newTeams = JSON.parse(JSON.stringify(teams));
newTeams[0].players.push('Green');

const shallowCopy = [...teams];
shallowCopy[1].name = 'Clippers';

const freezeTest = Object.freeze({nested: {value: 42}});
freezeTest.nested.value = 100;

console.log(teams[1].name, teams[0].players.length, freezeTest.nested.value);


>>Click here to continue<<

JavaScript




Share with your best friend
VIEW MORE

United States America Popular Telegram Group (US)