Chapter 14.3.3. A Word about Objects in JavaScript

You might have noticed that our isOrder function just checks that the object has items. What if there is some other object that has “items” on it? For the purposes of this script (and many JavaScripts on web pages), this is not a big concern. You don’t have so many different objects floating around that you’re likely to accidentally compare objects other than Orders that happen to have items. However, if you do want to play it safer, it’s important to know a bit about objects in JavaScript.

Python, like many object-oriented languages, has the notion of a class. A class represents a particular kind of object, and an instance is one example of that type of object. When you’ve got an ...

Get Rapid Web Applications with TurboGears: Using Python to Create Ajax-Powered Sites now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.