- Task 1: Use template literals to create a string that includes variables for a person's name and age, and log the string to the console.
- Task 2: Create a multi-line string using template literals and log it to the console.
- Task 3: Use array destructuring to extract the first and second elements from an array of numbers and log them to the console.
- Task 4: Use object destructuring to extract the title and author from a book object and log them to the console.
- Task 5: Use the spread operator to create a new array that includes all elements of an existing array plus additional elements, and log the new array to the console.
- Task 6: Use the rest operator in a function to accept an arbitrary number of arguments, sum them, and return the result.
- Task 7: Write a function that takes two parameters and returns their product, with the second parameter having a default value of 1. Log the result of calling this function with and without the second parameter.
- Task 8: Use enhanced object literals to create an object with methods and properties, and log the object to the console.
- Task 9: Create an object with computed property names based on variables and log the object to the console.
- Template Literals Script: Write a script that demonstrates the use of template literals to create and log strings with embedded variables and multi-line strings.
- Destructuring Script: Create a script that uses array and object destructuring to extract values and log them.
- Spread and Rest Operators Script: Write a script that demonstrates the use of the spread operator to combine arrays and the rest operator to handle multiple function arguments.
- Default Parameters Script: Create a script that defines a function with default parameters and logs the results of calling it with different arguments.
- Enhanced Object Literals Script: Write a script that uses enhanced object literals to create and log an object with methods and computed property names.
By the end of these activities, students will:
- Understand and use template literals for string interpolation and multi-line strings.
- Apply destructuring to extract values from arrays and objects.
- Utilize spread and rest operators for array manipulation and function arguments.
- Define functions with default parameters.
- Create objects using enhanced object literals, including methods and computed property names.