• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 16. Applied JavaScript > An Object-oriented Bar Graph Generator

An Object-oriented Bar Graph Generator

While we said in an early chapter that JavaScript was object-oriented (and therefore buzzword-compliant), and we've used objects throughout the book, nowhere have we shown how to create your own custom objects. And while the previous example works just fine, the code is sufficiently convoluted that it's a bit difficult to understand. It's examples like this where the power of custom objects becomes truly useful, so here's the same task as the immediately previous one, but done with custom objects that we create instead of solely using arrays. The results look the same, as shown in Figure 16.7, but the code is easier to understand.

Figure 16.7. The object-oriented version of the bar-graph generator provides identical results, but does it with cleaner code.



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint