Chaining
It's called Chaining
.
In JavaScript, chaining refers to the technique of calling multiple methods on an object one after the other, in a single line of code. The result of one method call is used as the object on which the next method call is made, and so on, creating a chain of method calls.
Literally you are creating chains of calls!
Chaining can make code more concise and easier to read, as it avoids the need to create temporary variables to store intermediate results.
Here is a full article about it
For your Example:
e.target.style.textDecoration
Variable e
is an object and target
property of that is an object too. then style
is a property of e.target
and so on.
Method Chaining
Method Chaining is a programming strategy that simplifies and embellishes your code. It is a mechanism of calling a method on another method of the same object.
This can be done for methods, too. If the method return type be an object
.
For instance:
documet.querySelector('.divClass').click();
Also there is A new operation you can check it out. It's called Optional Chaining
It checks parent not to be null. So no error will be issued if parent is null or non-object.
MDN Documentation