Main image of article JavaScript You Need to Know for a Job

JavaScript is a programming language that’s easy to pick up, but extremely difficult to master. Even some of its beginner-level functions are decidedly not beginner-friendly. When you land your first JavaScript job, you’re going to want to know as much as possible, if only so you can navigate through some of the language’s trickier aspects without needing to ask for help. Below is the bare minimum of what you’ll need to know to work with JavaScript (beyond the absolute basics such as variables, functions, the difference between null and undefined, and so on). For those who have some JavaScript knowledge, the following list might miss some specific elements you think belong there; but the idea here is that, if beginners are at a level where they understand the presented items, they probably understand the language enough to operate effectively. Check out the latest JavaScript-developer jobs.

The Beginner’s List

  • Know what a prototype is, what the “this” variable does, and how to use both.
  • Know the difference between a list and an object (and how a list is technically both, and can be used as both).
  • Know that functions are objects that can be passed as parameters into other functions and returned from other functions.
  • Know what closures are and how to use them. This might seem like an advanced topic, but when working with functions returning functions, it's easy to introduce bugs if you're not careful.
  • Know how to use functions such as the list's map and filter functions. With this in mind, I encourage you to read this specification and learn the methods available on all types of objects.
  • Know your way around the developer command line and debugger. All the major browsers provide these now.

Slightly More Advanced (Document Object Model)

The DOM (Document Object Model) is the browser's representation of a Web page. The DOM isn't technically part of JavaScript, but it's a big part of browser programming with JavaScript. As such, most employers are going to expect you to know your way around the DOM if you're applying for a JavaScript job. Vital aspects include:

  • Accessing the DOM directly from JavaScript. For example, know how to locate elements through calls such as getElementById, getElementsByClassName, getElementsByTagName, and so on. Also know how to use the newer selector methods: querySelector, querySelectorAll.
  • Accessing the DOM using jQuery. Again, jQuery isn't part of JavaScript, but a lot of employers expect you to know it. Know the difference between $('a') and $('.a'). A simple dot changes everything.
  • Understand the global object, how the browser provides the global object, and how you access it through your JavaScript programming. (Answer: The browser provides the window object (lowercase w) as the global object.) Understand why the browser is the service implementing the global object and what happens when you move JavaScript code outside of the browser, such as to Node.js.

A lot of documentation presents the DOM API using what looks like C-language interfaces. That's because under the hood, the objects likely are C objects. You access these objects through your JavaScript code. For example, when you call getElementById, you get back an element. But under the hood, that object is a C object with properties and methods. This page on the Mozilla Developer Network shows you the different properties and methods available. An element is descended from a node, which means, if you have an element, you can call any of the properties and methods available on this page for a node. Try it right now—press F12 and open up the console. Here's how you get an element: [js] e1 = document.getElementsByClassName('header-bar')[0] [/js] ...and then a child of that element: [js] e2 = e1.querySelector('.container') [/js] And then remove that second element. The interface for the node class tells us there's a removeChild function, so here you go: [js] e1.removeChild(e2) [/js] And watch the top bar on this page you're reading disappear. Done. (Refresh the page to bring it back.) In addition to the DOM, there's much more you'll want to study regarding Web pages and how they fit together with JavaScript. You must know how to add events to elements and how to handle the events. Know both the pure JavaScript way, [js] e1.addEventListener('click', function(e) {    console.log('CLICK!'); }, false); [/js] as well as the jQuery way: [js] $(e1).on('click', function() { console.log('CLICK 2!'); } ) [/js] Spend some time exploring the HTML5 features, such as how to save to local storage and manipulate a canvas element. Again, these are not technically features of JavaScript; they're APIs provided by the browser. But if you're trying to land a job writing code that runs in the browser, you'll want to know how they work. And then there's the biggie, Ajax. You must know what Ajax is—a way to make calls back to the server—and how to use it.

Even More Advanced

Now take your JavaScript programming to the next level. The more you know, the better. As before, here's a sampling of things to know:

  • Know how to call bind, call, and apply on a function, what the differences are, and why you would need to use them.
  • Know the different ways to create objects, including Object.create, and when you'll need the hasOwnProperty method:

[js] x = {a:1, b:2}; x.toString(); // prints out [object Object] x.hasOwnProperty('a'); // returns true x.hasOwnProperty('toString'); // returns false [/js] compared to: [js] x = Object.create(null); x.toString // is undefined [/js]

  • Know the different ways of implementing object-oriented programming, especially inheritance.
  • Know what promises are, and learn two important asynchronous libraries: async and Q. They're used a great deal in server-side Node.js programming, but can also be a huge benefit in browser programming.
  • Learn server-side Node.js programming. It will really force you to become a JavaScript guru.

Conclusion: Even Further

If you know the material in the third section, you're in great shape. But there's always more to learn. Want to take it even further? Learn about ES5 and the newest features of JavaScript that might not be present in all browsers. Learn the different frameworks, such as Backbone, Ember, Angular, and Knockout. The more you know, the more likely you'll land that job.