click below
click below
Normal Size Small Size show me how
SYSINTEG - L1
| Question | Answer |
|---|---|
| Unpack (extract values from arrays/objects) | Destructuring |
| Modify (transform every element) | map() |
| Find (keep only matching elements) | filter() |
| Reduce (combine everything into one value, like sum, max, min, or average) | reduce() |
| The type of destructuring where values are extracted based on their index position. | Array Destructuring |
| The type of destructuring where values are extracted using property names. | Object Destructuring |
| The symbol used to skip an item in array destructuring. | Comma |
| The operator used to collect the remaining elements in an array. | Rest Operator |
| The value assigned when a destructured variable is undefined. | Default Value |
| The process of giving a destructured object property a different variable name. | Renaming Variables |
| Destructuring can also be performed inside a function's ________. | Parameters |
| In array destructuring, variables correspond to the array's ________. | Index |
| A function that accepts another function as an argument or returns a function. | Higher-Order Function |
| These functions allow programmers to focus on the "what" rather than the "how." | Higher-Order Functions |
| The array method that transforms every element into a new array. | map() |
| The method that does not modify the original array while transforming its elements. | map() |
| The method commonly used to double every number in an array. | map() |
| The function often written using the => syntax in the examples. | Arrow Function |
| The array method that does not execute its callback for empty elements while transforming values. | map() |
| The array method that creates a new array containing only elements that pass a test. | filter() |
| The function used in the presentation to determine if an age is 18 or older. | checkAdult |
| The array method used to extract only even numbers. | filter() |
| The array method used to retrieve records where firstName == Chiz. | filter() |
| The array method that returns only elements satisfying a condition. | filter() |
| The array method that reduces all elements into a single value. | reduce() |
| The variable that stores the accumulated result in reduce(). | Accumulator |
| The value supplied as the starting value of the accumulator. | Initial Value |
| The method used to compute the sum of all elements in an array. | reduce() |
| According to the presentation, this method can also find the highest value in an array. | reduce() |
| The method used when you want to transform every element in an array. | map() |
| The method used when you want to obtain only the required values based on a condition. Answer: filter() | filter() |
| The method used to reduce an array into a single value such as sum, maximum, minimum, or average. | reduce() |
| What will be the value of num1? const numbers = [10, 20]; const [num1, num2] = numbers; | 10 |
| What will be the value of num2? const numbers = [10, 20]; const [num1, num2] = numbers; | 20 |
| What is the output of third? const colors = ["Red", "Green", "Blue"]; const [first, , third] = colors; | Blue |
| What is stored inside rest? const numbers = [1,2,3,4,5]; const [first, ...rest] = numbers; | 2,3,4,5 |
| What will be the value of age? const user = { name: "John" }; const {name, age = 18} = user; | 18 |
| . What is the value of num1? const numbers = { a: 5, b: 10 }; const {a: num1, b: num2} = numbers; | 5 |
| What JavaScript feature is used in the code below? const {name, age} = person; | Object Destructuring |
| What JavaScript feature is used in the code below? const [x, y] = numbers; | Array Destructuring |
| What method is used in this code? const doubled = numbers.map(num => num * 2); | map() |
| What is the output? const numbers = [1,2,3]; const doubled = numbers.map(num => num * 2); | 2,4,6 |
| Which function syntax is used here? num => num * 2 | Arrow Function |
| What happens to the original array after using .map()? const doubled = numbers.map(num => num * 2); | remains unchanged. |
| What method is used in this code? const adults = ages.filter(age => age >= 18); | filter() |
| What is the output? const ages = [12,18,20,15]; const adults = ages.filter(age => age >= 18); | [18,20] |
| What condition is being tested? age >= 18 | Age is greater than or equal to 18. |
| What method is used in this code? const sum = numbers.reduce((acc, num) => acc + num, 0); | reduce() |
| What is the output? const numbers = [1,2,3,4]; const sum = numbers.reduce((acc, num) => acc + num, 0); | 10 |
| What is the initial value of the accumulator? numbers.reduce((acc, num) => acc + num, 0); | 0 |