Throw is not a function, it is a sentence therefore when you do this
throw(new Error('Esto es un error'))
you are executing the throw statement that is accompanied by an expression and not a list of parameters therefore the parentheses of the first level are unnecessary and do not indicate the execution of a function but rather here they serve as an operator of grouping , therefore you can omit them.
throw new Error('Esto es un error')
do not get confused with the syntax of a function, that to execute it you must use the parentheses and send a list of parameters
function hola(nombre) {
console.log('Hola, ' + nombre);
}
hola('Pepe'); // Esto ejecuta la función
hola 'Pepe'; // Esto es un error de sintaxis
The parameters you send to the function are expressions
hola(('Pepe')); // Esto es igual a hola('Pepe');
here the first level of parentheses executes the function [hello], the second level of parentheses serve as a grouping operator that resolves to the same value 'Pepe'.
The functions in javascript can receive N amount of parameters, if when executing you send more parameters of the necessary ones then the function will take the first ones until it coincides with the number of parameters that it receives and discards the remainder.
hola('Pepe', 'Lucho', 28); // la función [hola] solo toma 'Pepe' e ignora el resto
but this is different from a list of expressions separated by commas such as
1, 'Hola', hola(('Pepe')), 'Lucho'; // Esto son 4 expresiones separadas por comas
function hola(nombre){console.log(nombre)}
The comma can be used to separate expressions that you write in a single line, therefore it is equivalent to this.
1; 'Hola'; hola(('Pepe')); 'Lucho';
The throw clause can receive an Error object or not, you can send any value to throw as strings, numbers or other objects.
throw new Error('Error 404 not found');
throw 'Error 404 not found';
throw 404;
So in your example this line
throw(1, 2, 3, new Error('Esto es un error'), 'El último')
is equivalent to
throw 1, 2, 3, new Error('Esto es un error'), 'El último'
As it is an expression and not a list of parameters, this expression is resolved to the last value, in your case it is the string 'The last one'.
throw (1), (2), (3), (new Error('Esto es un error')), ('El último') // Uncaught El último
throw ((1), (2), (3), (new Error('Esto es un error')), ('El último')) // Uncaught El último
and finally the semicolon delimits the sentence therefore these are not equivalent
throw 1, 2, 3, new Error('Esto es un error'), 'El último' // Uncaught El último
throw 1; 2; 3; new Error('Esto es un error'); 'El último' // Uncaught 1