While methods are just functions that are attached to objects, there is a difference in the way you use them with respect to side effects. With a function you do not want it to have any side effects on anything unless the specific purpose of the function is the side effect. With methods it is acceptable to have side effects provided that those side effects are contained within the object to which the method belongs.
The most obvious examples of methods with side effects are setters. These methods have the specific purpose of setting the value of properties of the same object. This type of side effect is an obvious extension to the idea of restricting function side effects to those functions where the specific purpose of the function is the side effect. You have somewhat more flexibility with methods though because we can look on the method as being just a part of the object and so any changes that the method makes that are contained within the object and which do not extend beyond the object need not be considered to be side effects at all.
By creating objects where values need to be able to be set by a function and retained for later use (and so allowing us to make that function a method of the object rather than a stand alone function) we can eliminate many of the stand alone functions which we would otherwise require to have side effects in their processing.
In JavaScript we do still have two groups of functions though where side effects are unavoidable and those are the ones that perform updates on the actual content of the web page and those which perform calls to the server in order to pass information intended to update data on the server. Even with these groups though we can sometimes gain benefits by using objects and making the function into a method of that object as that will at least tie the data within the JavaScript that relates to the part of the web page or the field on the server that is to be updated more closely to those external locations that the data relates to. Doing this makes the connection between the side effect and the purpose more obvious as it identifies the specific object within the JavaScript to which it all relates in a more obvious and direct manner.
While making your functions into methods of a relevant object (rather than defining them separately and thus making them properties of the window object) does not eliminate side effects, it does keep the side effects to a minimum and relates them more closely to the specific data they belong to.
