JavaScript is a popular web programming language. Oops. I wrote that sentence five years ago. JavaScript is now much more than just a popular web programming language. In addition to web, JavaScript is now a central language for programming Windows 8 Apps. Using JavaScript, you can now not only write powerful applications for the web, but you can also write native Windows applications.
Now more than ever, people are looking to learn JavaScriptand not just developerspeople who havent programmed before, or who may have created a web page or two along the way, are recognizing the importance of JavaScript. Its a great time to learn JavaScript, and this book can help.
This book covers not only JavaScript programming for the web but also covers beginning Windows 8 programming with JavaScript. Even though programming or running JavaScript code doesnt require Microsoft tools, this book is noticeably Microsoft-centric. The one exception to not requiring Microsoft tools surrounds programming of Windows 8 Apps. If youre looking for a more generalized JavaScript programming book, please see my JavaScript Step by Step book, which, although more advanced, looks at JavaScript programming through a wider lens.
Who Should Read This Book
This book is intended for readers who want to learn JavaScript but who dont have a formal background in programming. This characterization includes people who have perhaps created a web page, or simply been interested enough to view the source of a web page. It also includes people who are familiar with another programming language, but want to learn JavaScript.
Regardless of your background, if youre reading this, youre likely at the point where you want to learn JavaScript with some structure behind it. Youd like to write JavaScript code for practical applications, and also learn why it works.
In this book, youll create the code for the examples, and test that code in one or more web browsers. You can write JavaScript in any text editor, but the book will use a free version of Microsoft Visual Studio as the JavaScript editor.
Assumptions
This book assumes that youre familiar with basic computing tasks such as typing and saving files, as well as working with programs on the computer. The meaning of terms such as web browser should be clear to you as meaning programs such as Internet Explorer, Firefox, Chrome, Safari, Opera, and the like. A term like text editor shouldnt scare you away; hopefully youve fired up something like Notepad in Microsoft Windows before.
Who Should Not Read This Book
This book is not intended for readers who already have extensive JavaScript programming experience. Additionally, if youre completely new to computers and arent comfortable with the Internet and using computer software, this book might go somewhat fast for you.
Finally, if youre looking for a book to solve a specific problem with JavaScript or a book that shows JavaScript programs in a recipe-like manner, then this book isnt for you. Similarly, if youre not really interested in programming, and just want to learn how to add a counter or some other JavaScript widget to your page, there are plenty of free tutorials on the web that can help. Remember: this book shows not only how things work but also explains why things work as they do. Making something work once is easy, but explaining it and helping you understand why it works will help you for years to come.
Organization of This Book
The book is organized into eight chapters that build upon each other. Early in the book you will see working code. While you can cut and paste, or use examples from the sample companion code, youll have the most success if you enter the examples by hand, typing the code yourself. See the section later in this Introduction for more information on working with the code samples.
Conventions and Features in This Book
This book presents information using conventions designed to make the information readable and easy to follow.
The book includes several exercises that help you learn JavaScript.
Each exercise consists of a series of tasks, presented as numbered steps (1, 2, and so on) listing each action you must take to complete the exercise.
Boxed elements with labels such as Note provide additional information or alternative methods for completing a step successfully.
Text that you type (apart from code blocks) appears in bold.
A plus sign (+) between two key names means that you must press those keys at the same time. For example, Press Alt+Tab means that you hold down the Alt key while you press the Tab key.
A vertical bar between two or more menu items (for example, File | Close), means that you should select the first menu or menu item, then the next, and so on.
System Requirements
Writing JavaScript doesnt technically require any specialized software beyond a web browser and a text editor of some kind. You will need the following hardware and software to complete the practice exercises in this book:
While any modern operating system will work, youll find it easier if youre on a later version of Windows, such as Windows 7 or Windows 8. Additionally, youll need Windows 8 in order to follow some of the examples in the book that build Windows 8 Apps.
Any text editor will suffice, but youll find it easier to work through examples if you use Visual Studio 11, any edition (multiple downloads may be required if using Express Edition products)
A computer that has a 1.6GHz or faster processor (2GHz recommended).
1 GB (32 Bit) or 2 GB (64 Bit) RAM (Add 512 MB if running in a virtual machine or SQL Server Express Editions, more for advanced SQL Server editions).
3.5GB of available hard disk space.
5400 RPM hard disk drive.
DirectX 9 capable video card running at 1024 x 768 or higher-resolution display.
DVD-ROM drive (if installing Visual Studio from DVD).
Internet connection to download software or chapter examples.
Depending on your Windows configuration, you might require Local Administrator rights to install or configure Visual Studio 11.
Code Samples
There are numerous code samples throughout the book. As previously stated, youll learn the most by typing these in manually. However, I realize that process can become mundane (and Ill even admit that I dont type in many examples when I read development books).
To help take the pain out of typing in code examples, this book reuses as much code as possible, so if you type it in once, in most cases youll be able to reuse at least some of that code in later examples. This is both a blessing and a curse, because if you type it in incorrectly the first timeand dont get it workingthen that problem will continue in later examples.