After going through first two articles, Prototypes and Inheritance, it's time to do some practice and keep learning through doing. The example I came up with for this article is for learning purposes. It's not related to real-world use cases.
Thinking of a good example turned out to be tricky. One of the reasons for that is a difficulty of coming up with an example that has some kind of meaningful logic and hierarchy. Hopefully my solution will do the job.
The idea is the following:
- we need to create some kind of task items (as in todo projects). Let's say, they represent <li> elements in a way.
- now, we'll assume that there are two types of these items based on their priority: primary and secondary.
- further, let's assume that all task items have the same parent element (ul) and the same css class. One p