This tutorial worked through the differences between referring to a variable, array or object and making a copy that you can then manipulate without affecting the original. There were a couple key takeaways I found interesting with this exercise.
The first was that if you let one variable be assigned a value, then refer that variable to a new one and then reassign the first variable this doesn’t change the second.
Next I learnt three ways of copying an array. I think my favourite is using the spread syntax as follows:
const showHosts = ['Pinacolada Soundsystem', 'Fraserhead', 'Dave Branton', 'Dr Hitchcock']; const eightKayMembers = [...showHosts];