1. Spread Operator
The Spread Operator is used to unpack an iterable (e.g. an array, object, etc.) into individual elements.
1.1 Spread Operator with Arrays
1.1.1 Creating a Copy
1.1.2 Concatenation
1.2 Spread Operator with Objects
1.2.1 Creating a Copy
1.2.2 Concatenation
1.3 Spread Operator with Function Calls
The Spread Operator syntax can be used to pass an array of arguments to the function. Extra values will be ignored if we pass more arguments than the function parameters.
Try out the spread operator with arrays, objects, and function calls in the JavaScript Code Playground.
2. Rest Parameter
With Rest Parameter, we can pack multiple values into an array.
2.1 Destructuring arrays and objects with Rest Parameter Syntax
2.1.1 Arrays
2.1.2 Objects
3. Functions
3.1 Default Parameters
The Default Parameters allow us to give default values to function parameters.
Try out the Rest Parameter and Default Parameters in the JavaScript Code Playground.
4. Template Literals (Template Strings)
The Template Literals are enclosed by the backticks.
They are used to: 1. Embed variables or expressions in the strings 2. Write multiline strings
We can include the variables or expressions using a dollar sign with curly braces
Try out including the variables, expressions, and multiline strings using the Template Literals in the JavaScript Code Playground.