5 Things You Need to Know About JavaScript logo

Have you ever yearned to unlock the mysterious and abstract language of your coding friends? Maybe you’ve gazed longingly at your ashen, sleep deprived dev team hunched over screens of technicolour code straight from a Wachowski fantasy.

OK, maybe that’s overly romantic, but put simply, JavaScript is a greatest first computer language you can learn. Even if you don’t pursue a coding career full-time, learning even a bit of JavaScript will expose your grey matter to complex problem solving and logical thinking that’s bound to expand your mind.


  Image source.


There are lots of resources on JavaScript out there, and it can be hard to know what you need to understand, how much of it overlaps and what is redundant. So to help you on your way to mastering JavaScript here are 5 essential tips to help you get started, from one JavaScript rookie to another.


People say JavaScript isn’t even a real programming language. The first version, rushed out the door by Netscape in 1995, lacked essential features like exception handling and inheritance. But JavaScript’s latest incarnations have only added to what is now a fully-fledged object-oriented programming language. Even so, a lot of the unfair labels still refer to these earlier versions, so don’t listen to the haters.

As it’s based on C and heavily inspired by Java, JavaScript shares core concepts with many other programming languages. Manipulating data structures, working with objects and functions, are all there in JavaScript. From it’s humble beginnings,  the language has organically grown over the past 20 years to be a multiverse of elegant libraries and packages like jQuery and Node.js, and has become the most popular computer language driving the modern web experience.

Tip 1 – Just code it

You need to catch the coding bug, but this’ll never happen burying your nose in academic textbooks. The latest trend is online learning, with Khan Academy and Code Academy at the forefront. These  start you off writing code immediately, which helps melt the fear of programming and motivates you to learn more. But these services lack substance, so ebooks like Eloquent Javascript and Javascript Tutorial are great at accessing the meat of what it is you’re doing. And the best thing is they’re all free. If you’re after a physical object you can hold in bed, then you can’t go past the classic O’Reilly textbook JavaScript: The Definitive Guide, now on it’s 6th edition.

Tip 2 – Build something real

From online games to web applications, you can build just about anything in JavaScript. It’s even finding its way into physical devices such as wearable computers and other things of the Internet. So get creative and think of a real and tangible project which solves a problem.

For me, my boss at Glasshat wanted a page of automated charts comparing several SEO metrics from 3rd party and internal sources, benchmarked against a series of competitors; what we’ve “creatively” termed the One Pager. For this I had to learn about data structures and authentication, plus connecting to APIs from Glasshat, Facebook, Twitter and Google, as well as JS charting libraries to make it look pretty.

If you’re stuck for ideas, my advice would be a to try writing yourself a basic calculator. Or, if you’ve come from an Excel environment, try moving to Google Sheets, which has a JavaScript service built right in. Amaze your colleagues by building your own Excel-style functions in JavaScript!

Tip 3 – Get a mentor

At Glasshat I’m lucky enough to be surrounded by a small and talented team of front and back end developers with a passion for data science. They’ve been instrumental in helping shape my learning experience, from fixing bugs when I’ve got stuck to conceptual ideas such as JavaScript promises.

If you don’t have the luxury of working with really smart people like I do, then register a Github account. Github offers the developer community “distributed revision control and source code management”,  which is kind of like social media for nerds.

It’s a place where people share (and show off) their accomplishments in an open source tradition. And this is gold dust for a budding programming newbie. Lurk around projects which interest you, and when you feel comfortable, start contributing by fixing small bugs, and even building upon the original author’s ideas with new features. Be humble and open to constructive criticism, but like with anything in life, jettison the negative.

Tip 4 – Obsess over the browser console

The browser console lets you see how well your program is running – or not, as will be the case a countless number of times as you debug your code. It’s a somewhat unknown feature of modern web browsers such as Chrome or Firefox, but is an indispensable learning tool for the JavaScript newbie.

In the console, you can also run JavaScript in real-time very easily. Why not try it right now? Right-click (or double-tap for Mac’s) on this web page and select “Inspect Element” for Chrome or “Web Console” for Firefox . Now click the tab “Console”. You should get a flashing cursor. Try typing:

alert(“Goodbye Cruel World!”);

and pressing enter. Congratulations and well done! You’ve just wrote your first program.

Tip 5 – Embrace laziness

Larry Wall of Perl fame once said there are three great virtues of a programmer; laziness, impatience and hubris. I’m becoming a big believer in laziness, or the ability of writing code in a way which saves considerable time and energy.


One of the problems with the code now, learn later mentality is your technical ramblings will quickly degrade into a maze so complex and repetitive, even yourself will have difficulty understanding it. As Marijn Haverbeke so eloquently puts it:

“The art of programming is the skill of controlling complexity”.

Once you’ve written your first piece of code, expect to spend double the amount of time pulling it apart and re-writing it so it’s more generic, elegant and reusable.

A big thing for me early on was the discovery that functions can have parameters. While I saw people using them in countless examples, it took a while to fully appreciate how fundamental this is to programming laziness. Using functions and parameters means you can reduce repetitive code by creating little generic “machines” which accept one or more input variables. All you need to do is feed the machines your input, and you’ll get a nice output which can be reused again and again. Think of functions as the Ikea of programming. You can create one generic furniture module, say the wooden slats of a bed, and use these slats in many different bed designs.

Take the following conceptual coding example using two repeat functions to create a single and double bed:

(the following should be coloured with syntax highlighter to make it more legible)


Now check out the same conceptual example using a single generic function to create both single and double beds:


The generic example has fewer lines of code and doesn’t repeat itself. Now imagine writing an entire application using this mindset. It’s far easier to read, debug and reuse. But most importantly, other people will be able to understand it.

Whether you are a complete coding newbie, or you are a second timer who’s decided that it really is time you committed to getting your head around JavaScript, then we’re confident that these 5 tips will help you on your way to developing modern websites and web apps in no time…