How to implement this following scenario using Javascript or Jquery ??
create factory to create different types of animals e.g. snake, lion, tiger, fish, bird, etc. each of them derives from class animal animals base class has some properties each derived class has a special method unique to the specific animal e.g. fish.swim(), bird.fly(), snake.crawl(), lion.run(), etc.
the ui shows a drop down on the left that has 3 values (land, water and air) on choosing the value, right side should show appropriate animals (e.g. water => fish, air => bird, land => snake, lion)
I can understand that I can use Prototype or Observer pattern here but I am stuck with the proper implementation . But still confused about the proper approach and even if I get into something , coding wise I am stuck .