diff --git a/object.js b/object.js index 71df005..09dfa64 100644 --- a/object.js +++ b/object.js @@ -1,3 +1,5 @@ +// people, stuff and state constant variables so they remain unchanged + const people = ['Kookla','Fran','Ollie']; const stuff = { @@ -17,6 +19,24 @@ const newStuff = { ...stuff, cars: [...stuff.cars, 'Honda']}; let newState = {...state, people: ['Odie', ...people, 'Garfield'], stuff:{...stuff, cars: [...stuff.cars, 'Honda']}}; -console.log(newPeople); +console.log(newPeople); // [ 'Odie', 'Kookla', 'Fran', 'Ollie', 'Garfield' ] + console.log(newStuff); -console.log(newState); \ No newline at end of file +/* + { tv: 'huge', + radio: 'old', + toothbrush: 'frayed', + cars: [ 'Toyota', 'Mazda', 'Honda' ] } + */ + +console.log(newState); +/* + { people: [ 'Odie', 'Kookla', 'Fran', 'Ollie', 'Garfield' ], + stuff: + { tv: 'huge', + radio: 'old', + toothbrush: 'frayed', + cars: [ 'Toyota', 'Mazda', 'Honda' ] + } + } +*/ \ No newline at end of file