The output is `[30, 40, 50]`. This code demonstrates the rest pattern in array destructuring. The variables `a` and `b` are assigned the first two elements of the array (10 and 20 respectively), and the rest pattern `...rest` collects all remaining elements into a new array called `rest`. In this case, that includes the elements at index 2 and beyond: 30, 40, and 50. The rest pattern is useful when you want to extract some specific elements from the beginning of an array while keeping the remaining elements together as an array. It must be the last element in the destructuring pattern, and there can only be one rest element. This pattern works well with functions that accept a variable number of arguments or when processing arrays where the first few elements have special meaning and the rest should be handled collectively.