![Javascript](assets/m8_sidebar.jpg)
Javascript
Front-end development divides the web into three separate spheres: structure, presentation, and logic. Javascript is the language used for the logic layer. In this module, we will take a look at Javascript basics. We will cover the basics of objects, variables, functions, and events. These are the building blocks of the Javascript language. The best way to understand Javascript is to write some logic and make something happen.
First we'll track the size of our window object when a user resizes the browser. Then we will write the logic to make an exquisite corpse game, and we'll set it on a timer. Finally, we'll write the logic for a style-switcher inspired by the site Readability.com. While writing our demonstration pages, we will explore how Javascript addresses an HTML page using the DOM (Document Object Model).
The web can be seen as a three-layer cake. HTML represents the structural layer, CSS the formatting layer, and Javascript the behavioral layer. HTML defines all the parts of a web page; CSS says what those parts should look like. But neither of these languages allow for logic. If you want to interact with your web page, you need a scripting language.
Javascript is the language of choice. It has access to the entire page and the window it is displayed in. It is a scripting language designed to make HTML pages more responsive. It is lightweight, unencumbered by licenses, and can run client-side in the user's own browser. It has good browser support and is largely cross-browser friendly. Javascript is an ECMA language. and it shares a syntax with other popular web languages like PHP and ActionScript. In fact, Javascript is also known as ECMA Script.
Javascript is an object-oriented programming language. It doesn't need to be compiled. All you need to run Javascript is a browser. You don't need any special software to write Javascript, either -- any good text editor will do just fine.