Created
December 12, 2021 08:03
-
-
Save amrelarabi/34eafed60c8279761f50a329b4c432b2 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 oldArray = [1, 2, 3]; | |
const newArray = [...oldArray, 4, 5]; | |
// [1, 2, 3, 4, 5] المصفوفة الجديدة هى; | |
// يمكنك ايضًا إستخدامه مع objects | |
const oldObject = { | |
name: 'Kevin' | |
}; | |
const newObject = { | |
...oldObject, | |
gender: 'Male' | |
}; | |
// هذا هو object الجديد | |
{ | |
name: 'Kevin', | |
gender: 'Male' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment