If the function after its execution returns nothing to the main thread of the program, this is a bad function. After exploring jQuery, I was fascinated by the fact that any function returns the object itself, within which it is running. What does this give? The most important thing is the ability to consistently perform a series of operations on the same object, in one line.
I will give an example:
function coordinates (x, y) { x = parseInt (x); y = parseInt (y); ')
x = isNaN (x)? 0: x; y = isNaN (y)? 0: y;
var v1 = new coordinates (10, 10); var v2 = new coordinates (20, 20);
v1.plus (v2) .plus (v2); // There could be other operations here. alert (v1);
It is obvious that in some cases (in this example it is toString), it is simply illogical to return an object as a result of the function. And the solution, of course, lies on the shoulders of the developer. For my part, I can only recommend not to leave empty functions. If there is no explicit value that can be returned to the main program, feel free to return the object itself!