JavaScript is an interpreted language. (usually)
The most common use case for JavaScript code is within the Web browser.
The Ultimate Trio
JavaScript was originally developed by Brendan Eich and shipped with Netscape Navigator 2.0 in 1995.
In 1996 it was submitted to ECMA International to become an industry standard. It has been evolving ever since.
Did you know? Top 10 languages on GitHub in 2013:
Rank | Language | # Repositories Created |
---|---|---|
1 | JavaScript | 264,131 |
2 | Ruby | 218,812 |
3 | Java | 157,618 |
4 | PHP | 114,384 |
5 | Python | 95,002 |
6 | C++ | 78,327 |
7 | C | 67,706 |
8 | Objective-C | 36,344 |
9 | C# | 32,170 |
10 | Shell | 28,561 |
JavaScript's syntax is C-like. It is also weakly typed.
JavaScript employs function scoping, which is different than block scoping.
JavaScript employs prototypal rather than classical inheritance.
There are therefore no classes in JavaScript, only objects.
So objects "inherit" from other objects.
Look how easy it is to create objects in JavaScript:
Arrays have a nice literal syntax, too:
As do regular expressions:
Functions are at the heart of what makes JavaScript great. The best way to get a feel for them is to jump in and try.
And now, on to jQuery...
jQuery is a JavaScript library that makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler. It also takes care of making these functionalities cross-browser.
jQuery uses the façade design pattern, meaning that access to the entire API is done through a single function:
Typically you pass jQuery a string CSS selector:
And it returns the elements, wrapped in a jQuery object, that match the selector. Then you call methods on the jQuery object to manipulate the elements.
Another common use case for jQuery is to make asynchronous requests.
Let's dive in and build our own JavaScript application with jQuery.
The best place to learn jQuery is its official documentation, api.jquery.com.
One last note...
JavaScript is a great language to write big software in.