The code is very simple, mainly to provide you with an idea, and it can also be regarded as a small practice after learning JavaScript for such a long time.
Chain programming is to link multiple operations (multiple lines of code) together through the period "." into one sentence of code. Chain code usually requires operations to have a return value, but many operations are mostly void and return nothing, which makes it difficult to chain. Of course, there are solutions, which may not be elegant. The new idea of chain programming has been popularly used in jQuery
If you have any questions, please leave a message and we can make progress together