What is JavaScript and why learn it?

JavaScript illustration showing a computer screen

A near-ubiquitous programming language, JavaScript powers many of the online tools you use every day. We sat down with our senior instructor Keith for a coffee and talked about the history of JavaScript. Find out why it’s a must-have skill for developers.

JavaScript was originally invented to make web browsers more interactive. When Netscape came out in 1994, it just rendered HTML and images; internet users could only read web pages, click on links and fill in forms. Thatโ€™s a little like what Wikipedia was like initially for example: basically text, with some images: maybe maps and diagrams without much interaction really involved.

Netscape was one of the first web browsers available to the public and the people who built it wanted the browsing experience to be more app-like. In those days there were Windows apps and Apple Mac apps on our computers, just like we have today. But websites werenโ€™t like apps, they were just about reading things really.

Netscape needed a programming language that would allow website builders to add functionality. For example, if you have a button on a website and somebody clicks it, then something has to happen. And in order for something to happen, you have to attach some code to that button.

Thatโ€™s the kind of thing JavaScript can do.

Java vs. JavaScript

Programmers at Sun Microsystems had created Java (another programming language that we teach at CodeClan) and at the time that was the new kid on the block, seen as a fancy new language. Originally designed for interactive television it was also suitable to be used on the back-end of internet apps. Sun were keen for Netscape to use Java as the language that would make websites more interactive and app-like.

Netscape got in touch with one of their ex-colleagues called Brendan Eich and he was drafted in to work with Netscape. When he came on board he was eventually tasked with working out which language to use to make Netscape more interactive.

He set aside Java because he thought it was too difficult for the average website builder to use. In those days website builders werenโ€™t programmers; they werenโ€™t engineers. But Java is a complex, quite advanced and difficult programming language.

Netscape needed something easier for website designers to use – something they could pick up really quickly and add little snippets of code to buttons and forms and things like that. They wanted something more script-like that could run in the web browser.

So the legend is that Eich went away and wrote JavaScript in 10 days. He came back with what was developed under the name Mocha originally and was officially called LiveScript. And they eventually got permission from Sun Microsystems to use the word Java, so they called it JavaScript – possibly for marketing reasons as Java was the bees knees at that time.

The language of web browsers

Even though some of its syntax is similar to Java, JavaScript is a very different beast and behaves in a different way. But it is the language of web browsers essentially.

Originally it was quite simple and you could do reasonably straightforward things with it. Today itโ€™s a fully-fledged programming language and can now be used on what we call the back-end as well, which isnโ€™t the browser but the server-side.

Web servers can now be written in JavaScript and you can even interact with databases with it and build what we call full-stack applications.

For the front end, think about Netflix or AirBnB and the way you interact with them. It’s very smooth and if you hover over something, for example, it might pop up and show you a description. You click a button to “Add to Favourites” and boom! It’s added to your favourites.

That’s all happening in the browser. There are no extra page refreshes that have to happen in order for your application to save a movie to your favourites list.

The logic runs in the browser and itโ€™s written using JavaScript. So you write JavaScript, usually in conjunction with your HTML so it interacts with the HTML and the HTML can be updated and manipulated by the JavaScript.

The JavaScript ecosystem and its challenges

JavaScript is an implementation of a specification standardised by an independent body at Ecma (which had been the European Computer Manufacturers Association). They’re now the body that says what JavaScript should do, what the new versions should do and in the last few years theyโ€™ve been releasing new versions of the specification every year.

Itโ€™s then up to the browser vendors – like Internet Explorer, Edge, Firefox, Chrome, Safari –ย  to update their JavaScript engines inside the browsers to conform to the new standards. They donโ€™t always do that promptly because theyโ€™re not forced to, so when you write your JavaScript and a person is using a browser that is not up to date, your JavaScript might not work in that browser.

This is one reaseon that front-end Javascript – meaning the JavaScript that runs in your browser – can be notoriously difficult to code. As applications get more complex, like Netflix for example, they require a lot of code and a lot of organisation and engineering of that code to make it extendible, editable and maintainable.

Frameworks

Eventually people started coming up with what are called libraries or frameworks, which are written in JavaScript and help developers to organise code. These were things like Backbone and Knockout. More recently, Google created Angular for Gmail, and then Facebook created React which is a user-interface library that makes it a lot easier to organise your JavaScript code.

When youโ€™re writing front-end JavaScript you usually use one of these libraries or frameworks to make it faster to develop, easier to maintain and typically faster to run in the browser.

We teach React at the moment at CodeClan because itโ€™s fairly straightforward to pick up and get going with, the documentation is really good and industry data says that itโ€™s accelerating in terms of adoption by companies and developers and – certainly in Scotland – itโ€™s up there with Angular as the most popular type of front-end library that you should learnโ€ฆ once youโ€™ve learned JavaScript!

CodeClan students will always learn JavaScript first and then learn how to use React, rather than just jumping in and learning React. You could just learn how to use React without knowing any JavaScript, but that ties you to only knowing how to use React and it would be hard for you to move to Angular or another front-end framework if you didn’t already know JavaScript.

So we spend a lot of time doing what we call vanilla JavaScript, which is just JavaScript the language, without any frameworks. And then we spend some time on React once the students have understood JavaScript.

So… is JavaScript worth learning?

Of course! Most technology companies have an element of JavaScript somewhere, if not their entire stack. Most of the popular websites people use will have heavy JavaScript involvement, including Netflix, Gmail, Mailchimp, Airbnb, Amazon, Facebook etc.

Sound like a valuable skill to you?


Learn JavaScript at CodeClan

JavaScript is one if the three core languages on our 16-week Professional Software Development course (the other two being Java and Ruby). During a 5-week module, you’ll get to grips with JavaScript from a full-stack perspective, starting with Vanilla JavaScript, using a framework and completing a group project.

Want to know more? Just us at our next info session.

Subscribe

Receive our newsletter to hear about courses, events and more.

Search

Donโ€™t be a stranger... Stay in touch!

Why not sign up to our newsletter? We will keep you informed about new courses and also send you information from the world of digital.

Enter a query in the search input above and hit return to see results.

We'd love your feedback!

Did you find what you were looking for?