JavaScript - Data Structures, Modern Operators and Strings
Last Updated on: October 16, 2021 pm
JavaScript - Data Structures, Modern Operators and Strings
Destructuring Arrays
Switch the two variables.
1 | |
1 | |
get r = undefined
Destructuring Objects
Set a default value
1 | |
Mutating Variables
1 | |
{} means code block
Needs to wrap the destructuring assignment into parenthesis.
1 | |
The Spread Operator
The spread operator ...arr takes all the elements from the array and it doesnt create new variables.
Only use it in places.
Copy Array
1 | |
Merge Arrays
1 | |
REST Pattern and Parameters
1 | |
The rest patter always must be the last element in the array.