No, this is not "What I have tried". If you really tried it by yourself, you would not ask for the explanation. Such explanations are counter-productive. It's not clear what should be explained, based on what level of knowledge. Even more importantly, it can take enormous amount of time and turn out completely useless.
Reading someone else's code which you don't understand is not a real way of learning. You can rather learn by reading manuals and documentation and writing code by yourself.
As to the API you are asked about in the title of the question, this is the function which returns array-like object. This is well explained here:
Document.getElementsByClassName() — Web APIs | MDN[
^].
If something is unclear in this explanation, you should rather start learning JavaScript and general programming from scratch. Perhaps you can start with
JavaScript | MDN[
^].
—SA