JavaScript You Need to Know for a Job

shutterstock_130719125

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:


e1 = document.getElementsByClassName('header-bar')[0]

…and then a child of that element:


e2 = e1.querySelector('.container')

And then remove that second element. The interface for the node class tells us there’s a removeChild function, so here you go:


e1.removeChild(e2)

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,

e1.addEventListener('click', function(e) {

   console.log('CLICK!'); }, false);

as well as the jQuery way:


$(e1).on('click', function() { console.log('CLICK 2!'); } )

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:

x = {a:1, b:2};

x.toString(); // prints out [object Object]

x.hasOwnProperty('a'); // returns true

x.hasOwnProperty('toString'); // returns false

compared to:


x = Object.create(null);

x.toString // is undefined

  • 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.

Image Credit: Piotr Adamowicz/Shutterstock.com

Comments

7 Responses to “JavaScript You Need to Know for a Job”

June 11, 2015 at 9:52 am, Jim Hewitt said:

It’s unfortunate that we’re going backwards with this proliferation of JavaScript. This is just going to lead to more unmanageable code. Reminds me of what it was like to debug C code that was filth.

Reply

June 11, 2015 at 11:03 am, Larry said:

Java script was supposed to go away and make room for more powerful server based code. Unfortunately Java script is not going away and has become more popular in recent years…

Reply

June 11, 2015 at 1:52 pm, fumblebunny said:

Turns out this is all entirely too exhausting to keep up on. I just figure this stuff out as I need it because one week later, I don’t need it at all. I’ve done all these things and have since forgotten all these things. So pack it in your head in case you have a job interview and then promptly forget it all soon thereafter. This is how IT really works.
-the bunny

Reply

June 13, 2015 at 8:07 am, Nightcrawler said:

——pack it in your head in case you have a job interview and then promptly forget it all soon thereafter. This is how IT really works.—–

I read the companion article to this one, about Python, which really discouraged me. My comment was that it sounds like it could take months to learn enough to get a job. I don’t have six months to a year to learn enough to get a job; I need a job now.

Then I saw your comment, and I wonder if I’m overcomplicating things. Maybe I just need to learn enough to pass a FizzBuzz test (which I can) and answer interview questions, and then worry about picking up the rest of it as I go along.

Reply

June 15, 2015 at 6:26 pm, David Gray said:

I’ve been in IT for nearly 40 years, and what fumblebunny said hits the nail on the head.

Reply

July 09, 2015 at 6:31 am, Dave Martin said:

^^^ Why 80% of IT projects fail

Reply

September 19, 2017 at 2:05 am, Jessica Barnes said:

This is blog is really helpful to me to get a job as a javascript developer. Thank You for writing wonderful information for the freshers who are looking job in IT industry.

Reply

Post a Comment

Your email address will not be published.