In your first example, you are enclosing the arrow function inside an anonymous function and executing it by passing the parameters to it, in your example you do not need to pass parameters because you do not need them, therefore you call it (tuFuncion) (yourParameters) .
Your second example is not executable because it is not well formed.
If you want to save the anonymous function in a variable to later execute it, it would be the following:
var someFunction = () => alert("Error");
someFunction();
Or you could also do it online as your first example:
(() => alert("Error"))()
To convert an arrow function to a normal function you only have to translate the syntax:
var sumarNormalFunc = function (a, b) {
return a + b;
}
sumarNormalFunc(5, 5);
var sumarArrowFunc = (a, b) => {
return a + b
};
sumarArrowFunc(5, 5);
Source: Link