Appendix A. A JavaScript overview
JavaScript is the primary client-side programming language you’ll be using when writing HTML5 applications. Using JavaScript, you can select anything on a rendered page, save and work with data in memory, and communicate asynchronously with the server. Using additional frameworks such as jQuery, you can speed up your development tasks while reducing the volume of delivered code.
You may be somewhat familiar with the basics of JavaScript, but this appendix may still help you iron out some of the details that aren’t very apparent during normal operations. Things like unobtrusive JavaScript and method chaining can be a real challenge without a solid foundation in the language.
JavaScript is a functional language that’s deployed uncompiled in text files. It’s possible to use JavaScript as an object-oriented language, but you would be mistaken to try and use it the way you use C#. JavaScript looks very similar in construction to C#, but they’re completely different languages providing very different development experiences.
First, we’ll look at the various pieces of construction syntax that make up JavaScript code:
- Variables
- Operators
- Flow control
- Strings and dates
- Declaring and using functions
- Timers
- Arrays
- Checking for null, undefined, and NaN
- Comments in JavaScript