O'Reilly logo

Professional jQuery by Rob Larsen, Cesar Otero

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 2

JavaScript Primer

WHAT’S IN THIS CHAPTER?

  • Understanding JavaScript Primitives
  • Using Variables, Functions, and Objects
  • JavaScript Scope, Closures, and Execution Context

It’s easy to forget that jQuery is a JavaScript framework; after working with it for an appreciable amount of time, jQuery seems and feels almost like its own language. Inside the jQuery source, examples are abound of how to apply great JavaScript techniques. However, to truly master jQuery, you must master JavaScript. JavaScript is a very powerful and expressive language. All the major browsers support it, it’s the driving force in modern web applications utilizing Ajax, and now it’s made a major debut on the mobile web platform.

JavaScript inherits some names and naming conventions from the Java language, but that’s about it. In contrast to Java, JavaScript is a dynamically typed, object-oriented scripting language that runs in a host environment, usually a web browser. It contains no classes, and uses prototypes for inheritance. It also has functional programming features; closures, functions as first-class objects, anonymous functions, and higher order functions. In reality, JavaScript is closer to a language like Lisp than it is to Java.

This chapter revisits a subset of JavaScript syntax necessary for understanding how jQuery works, its core, and how to better apply it to your projects. It begins with a brief review of data types and object-oriented programming, and then delves into functional ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required