Created
September 15, 2021 05:23
-
-
Save droidjahangir/70598f0d52a48ae6ce058ededa12503a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const hobbies = ['Sports', 'Cooking']; | |
const activeHobbies = ['Hiking']; | |
activeHobbies.push(...hobbies); | |
// const activeHobbies = ['Hiking', ...hobbies]; | |
const person = { | |
name: 'Max', | |
age: 30, | |
}; | |
// We're copying the pointer/reference of the person object in memory to this copiedPerson constant | |
const copiedPersonShallow = person; | |
// To create a real copy | |
const copiedPersonDeep = { ...person }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment