Javascript Guide - Introduction
You can now also navigate the guide through the table of contents.
Introduction
In the following posts, we're going lean some of the basic concepts of javascript, as well as some more advanced ones.
This is not a crash course to manipulating your web pages. In fact, it's going to take quite a little while before we get to touch anything related to the DOM - the main JS interface for manipulating webpages.
What you are going to learn is the basic foundations, and some of the more complex but powerful aspects of the language, the parts that makes it a strong and robust language.
My goal here is that by the end of the guide, you will be able to go out and educate yourself, reading other people's code, and learning how to use one of the major frameworks to leverage your code, not just do stuff for you (like many people use JQuery today).
So - What Is Javascript?
WikipediaJavaScript is primarily used in the form of client-side JavaScript, implemented as part of a web browser in order to provide enhanced user interfaces and dynamic websites. However, its use in applications outside web pages is also significant.
Javascript is a scripting language, which was created by netscape to allow developers to create Interactive web pages. There is a lot of history behind this one, But the language that we are used to calling javascript is actually named ECMAScript, which is the standardized version of javascript.
We use javascript in our webpages by using the script tag in our HTML. This can be done either inline, or by pointing out to an external file. At almost all use cases, it is a best practice to use external files. In the following posts, I will teach you how we can use these external files to interact with our page.
For this series I am assuming you have at least some basic knowledge of HTML, and it's tree-like structure.
Tools
We are going to use 3 main tools:
- Firefox - at least for now, we are going to focus on client-side javascript. For this we will use Firefox. The reason - FireBug
- FireBug - probably the most advanced web developing tool out there. In the beginning, it's only use for us will be it's console, with which we can run arbitrary code.
- A text editor. I like using Notepad , but you can use whatever you like. At the beginning, we're going to do a lot of experimenting via the console, but as we go along we will start writing JS files.
Whenever I will post a code snippet, it will be followed by a link that will run that code. For example:
console.log('Hello');
Now, Let's get familiar with the console. When you open up Firebug, you will notice that you have a few tabs available to you. The first of which is console. At the bottom, you will notice a command line. When used, it will run JS operations on our page. Type in console.log('Hey!') and press enter to see your code executed.
Also, if you'll notice, at the right edge of the command line there is a red arrow pointing up. Press it, and it will allow you to execute multiple lines at a time (using the run button).
Lastly, notice the clear button. This will clear the console output. I recommend you use this one before you execute any code, so that the output will be clear.
If you want to exercise what you learned, there is a great project on github called JS Koans that offers some really nice JS exercises. Note that since it's written in JS, you might want to read a bit before committing into it, but it's really quite good.
With that in mind, let's move on to learning the basic foundations of javascript.