Chapter 1. Object-Oriented JavaScript
Ever since the early days of the web, there has been a need for more dynamic and responsive interfaces. While it's OK to read static HTML pages of text, and even better when they are beautifully presented with the help of CSS, it's much more fun to engage with applications in our browsers, such as e-mail, calendars, banking, shopping, drawing, playing games, and text editing. All that is possible thanks to JavaScript, the programming language of the web. JavaScript started with simple one-liners embedded in HTML, but is now used in much more sophisticated ways. Developers leverage the object-oriented nature of the language to build scalable code architectures made up of reusable pieces.
If you look at the past and present buzzwords in web development, DHTML, Ajax, Web 2.0, HTML5, they all essentially mean HTML, CSS, and JavaScript-HTML for content, CSS for presentation, and JavaScript for behavior. In other words, JavaScript is the glue that makes everything work together so that we can build rich web applications.
However, that's not all; JavaScript can be used for more than just the web.
JavaScript programs run inside a host environment. The web browser is the most common environment, but it's not the only one. Using JavaScript, you can create all kinds of widgets, application extensions, and other pieces of software, as you'll see in a bit. Taking the time to learn JavaScript is a smart investment; you learn one language and can then write all kinds of different applications running on multiple platforms, including mobile and server-side applications. These days, it's safe to say that JavaScript is everywhere.
This book starts from zero, and does not assume any prior programming knowledge other than some basic understanding of HTML. Although there is one chapter dedicated to the web browser environment, the rest of the book is about JavaScript in general, so it's applicable to all environments.
Let's start with the following:
- A brief introduction to the story behind JavaScript
- The basic concepts you'll encounter in discussions on object-oriented programming