Created
August 16, 2023 16:30
-
-
Save suhailgupta03/2fc20b593c57ee70d113e1215d025536 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| let employee = { | |
| name: 'John', | |
| age: 30, | |
| salary: 1000 | |
| } | |
| const {name, ...others} = employee; | |
| // ...others means that all the other | |
| // properties of the object will be | |
| // stored in the others variable | |
| // except the name property | |
| // because we have already stored it in | |
| // the name variable | |
| // ...others is called the rest operator | |
| console.log(others); | |
| const list = [1,2,3,4,5]; | |
| const [first, two, ...otherNumbers] = list; | |
| console.log(otherNumbers) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment