Everything you need to know to get started with Javascript

If you are interested in Web Development, JavaScript is one of the languages you must learn.

Published Date
05 - Jan - 2016
| Last Updated
06 - Jan - 2016
Everything you need to know to get started with Javascript

JavaScript was developed in May 1995 by Brendon Eich who worked for Netscape Communications Corporation. JavaScript was conceived from the need to make web pages more dynamic. Eich created it in just 10 days. JavaScript was originally named Mocha by Marc Andreessen the founder of Netscape. The name was then changed to LiveScript before finally receiving a trademark license from Sun to be called JavaScript. Though they did not want people to think the language was influenced by Java, they wanted to latch on to the hype and publicity Java was receiving in the early 1990s.

Learn javascript tutorial
Brendon Eich

Environment-wise, JavaScript is probably the easiest language one can execute. Anyone with a computer or a smart phone is fully equipped to run JavaScript programs or even make their own. The only requirements are a browser and a text editor. No complex developmental environments to install. No IDE’s to get familiar with. Due to the ease with which JavaScript can be used and executed, many developers think of it as a toy or a weak language. However it is probably one of the most advanced languages developed to date. Many very advanced projects have been developed using JavaScript from office suites such as Zoho.com to social integration tools such as Facebook’s JavaScript SDK.

Most popular language

Every programmer worth his salt will have a Github account. So one can tell a lot about the current technology in use, by the number of Github projects based on it. JavaScript Projects have shown a steady incline every since the creation of Github in 2008.
Ironically Ruby, the language in which Github was written has shown a steady decline. It should be noted that NodeJS, a JavaScript framework (more on this later) has been a major contributor to the increase in JavaScript projects.

Learn javascript tutorial
RedMonk’s popularity ratings for programming languages lists JavaScript right up there

Most impressive features

Just In Time (JIT) compilation
Just In Time (JIT) compilation is compilation done at the time of execution. JIT Compilation is also called dynamic translation. This allows for high speed execution. In modern browsers JavaScript is compiled, optimised and executed at runtime. The performance is so good that it is comparable to software written in C or C++.

Object Oriented Programming
JavaScript uses all the object oriented programming concepts such as encapsulation, inheritance, polymorphism, etc., and adds to that as well. In fact some OOP concepts can be implemented in better ways using JavaScript features called ‘lambda’ and ‘modules’.

JavaScript shares some syntax with Java, though its own syntax is easier, concise and more flexible. It has been adapted to become the dominant standard of client-server communication using JSON. JSON has since replaced XML since it is more compact and flexible.

Everything executed in the browser occurs in a single loop hence JavaScript code is highly dependent on event handlers and AJAX calls. This allows for a smooth and responsive UI no matter what the background processing may be.

A language wouldn’t be worth learning if the code were not reusable. Especially for the web where tasks such as validation are required often. JavaScript allows you to write code that can be run both server side and client side.

Learn javascript tutorials
JavaScript winning another popularity contest by a mile, and then some

Advantage of JavaScript over Others

Built-in interpreters
All browsers have JavaScript interpreters built in. No other language has this advantage and its highly unlikely that this will change any time soon.

Easy debugging
All browsers also let you debug your code easily. If dissatisfied with this you can use a plugin or tool to help debug. These plugins are free and small in size. Firebug for Firefox and Web Developer Toolbar for Chrome are examples of this.

Functions as objects
Functions can be used as objects and variables. This is a highly useful tool when it comes to reusability. You can literally mold old code on the fly.

Ready resources available
JavaScript developers are privy to a vast collection of free and powerful Frameworks and libraries. 

Ultra fast execution engines
There are three ultra fast JavaScript engines today each competing with the other to become better. These are FireFox’s SpiderMonkey, Google V8 and Safari JavaScriptCore.

Both Clientside and Serverside
Javascript was originally made as a purely client side language but gradually became a server side implementation as well. NodeJS is one such example.

Hello World in JavaScript

All JavaScript is written within HTML code and enclosed between two tags <script> and </script>.
….your code

So let’s go ahead and see what our standard snippet of code that says Hello World looks like in JavaScript.
alert(“Hello World!”);

This bit of code, when executed will output “Hello World!” in the form of an alert box on your screen.
Alternately you could print it directly on the webpage by using the document.write() statement.
document.write(“Hello World!”);

Using JavaScript frameworks and libraries

Developing large software can be daunting and time consuming. To overcome this, developers resort to frameworks and libraries. A framework is basically a tried and tested design/configuration of your software components. The most popular JavaScript frameworks are AngularJS, Backbone.js and Bootstrap.
A library is a set of predefined functions grouped together that are reused in many places implemented in the most efficient way possible. The most popular libraries are jQuery, Prototype and Dojo. Libraries allow you to do anything from creating and displaying graphs to processing and displaying PDF files.

Interesting Tools

Grunt is a JavaScript task runner that’s used to automate repetitive tasks such as minification, unit testing, linting etc. Configure a Gruntfile and the task runner does everything else. Twitter and Adobe actively use Grunt.

Mocha is a testing framework for JavaScript that allows you to perform both synchronous or asynchronous tests. It is hosted on Github.

It is a document based NoSQL database. It offers fast querying and updating, flexible aggregation and data processing. It is easy to scale and uses internal memory for storing current data which enables faster access.

Sinon is a Javascript library which provides spies, stubs and mocks for JavaScript. A Spy is a function that records metrics passed to it. A stub is a spy with some preprogrammed functionality. It can perform actions based on the metrics passed to it.
The four tools mentioned above only graze the surface of the vast amount of readymade tools available for JavaScript. There’s probably a tool for almost every need, and if there isn’t it’s easy to write your own, but remember to make it free for others to use.

Learn javascript tutorial

Tools to learn JavaScript

W3Schools for HTML and CSS
To learn JavaScript you must have some basic knowledge of HTML and CSS. For that w3schools provides some fairly good step by step tutorials for the bare basics. It should be used only as a quick reference tool though since as a learning tool it doesn’t quite measure up.  

The Mozilla developer network
The Mozilla Developer Network is a also good place to start. It always has freshly updated content, is well maintained and has  thousands of documents on a variety of subjects such as HTML5, Node, Javascript etc. 

Code Academy
CodeAcademy has some free tutorials, and you don’t even have to sign up to use them. They’re slow though, so if you’re an experienced coder, you won’t like them. 

Douglas Crockford
For the slightly experienced, Douglas Crockford from Yahoo! has some good tutorials you can download and watch. He gets straight to the point, and focuses on how to get things done rather than delve into the minor features. or buy his book, JavaScript: The Good Parts.

Tools for JavaScript frameworks

AngularJS offers a powerful framework to build large apps, but has a steep learning curve. It is often described as a hockey stick – very easy initially and then increasingly hard thereafter. If you master it, AngularJS will help to build the most robust, large scale applications. here and here

Backbone.js is highly useful for building Single Page Applications (SPAs). It is a small library, but gives you an enormous amount of functionality. Check it out.

Bootstrap is a framework to develop mobile-first, responsive projects on the web. Check it out here and here

JSFiddle provides a custom environment to test your JavaScript,HTML and CSS right in your browser. It is described as an online playground for JavaScript. Users can select individual JS versions, libraries and frameworks with which they want to test their code. This is a must use tool. 

Learn javascript tutorial

For tutorials on 15 other hot programming languages go here.