This is where you need to use a return statement. Now, there are times when you write a method that returns an object, but you want to use the return statement to get the result of the method. For instance, if you had a method to generate a random number, you might want to write a function to generate the same random number but return the return value.
To use the return statement, you would basically write a method that has two lines. The first line says “return this. The second line says “return this. The problem with this is that this will return the object.
This is a common practice used for method chaining. The problem with this is that if you call the object’s method, it will always return the same object it was called on, which could make it hard to determine the actual result of the method.
If you need to return the same object that was returned by the method, you can use the this keyword. But that can create a rather confusing situation. For instance, if a function was called and returned the object of the function, you never knew which function it was.