3 tips when learning JavaScript

3 tips when learning JavaScript

If you are looking to become a web developer at any point in time, then JavaScript is going to have to be your go to programming language. At some point in time JavaScript was mainly used to show pop-up alert boxes and to change background colors when you clicked on a button. Things have changed alot since the 90's.

Thanks to new hardware and new internet based technology, JavaScript is probably now one of the most popular programming languages globally. It's not the fastest, and it can't render super high res 8k video in real time (yet), but it is 100x what it used to be in its early beginning.

And all of that means one thing for new developers. That it's getting harder to learn. There are new API's getting added to the specification around the clock and there are old ones getting removed equally as fast. Staying up to date is no longer as simple as reading a single blog post online. Though I thank you for it.

So if you are just getting started in web development, more specifically, in learning JavaScript here are a few ways to make the process alot easier. Particularly during this time in its history.

3. Setup your development environment

And more importantly, know what a development environment is when it comes to working with JavaScript. While true that you can pretty much just open up notepad.exe, write some code, and save it with a .js extension, there are way better ways now.

We have cross-platform and lightweight coding editors now that can double check your code and highlight any potential issues. At a minimum, you should be coding in something like VSCode. For one, it's free. And secondly, the customization of VSCode is impressive. You can pretty much customize the editor to match any criteria that you might have.

Next up, you should install Node.js. You can download and install the runtime right over here. It's totally fine if you don't want to be a Node.js developer, but for the sake of running, testing and debugging JavaScript, this will be your best bet.

There's a good chance that you will have to work with a JavaScript library at some point in your coding life as well and getting familiar with how to use npm (Node Package Manager) in order to manage your libraries.

And lastly (in terms of software), you should set up Github. You might not be ready to start publishing your own open-source projects for the world to see just yet, and that's totally fine. But being able to clone someone else's project, whether an example or a framework, is a common-enough scenario that you will need to know the basics.

I also include learning material in this category. Since I went to college for Computer Science, I pretty much still make textbooks my de facto standard for learning. For one, most books are typically ordered very well, meaning I don't have to guess as to where to go next. And secondly, you can pass them on once you are done with them.

A book that I always recommend to pretty much everyone that wants to get into JavaScript, is Secrets of the JavaScript Ninja by John Resig. John Resig is the original lead developer of jQuery, and while the book is probably a bit older than what's out there right now, I still think that it has plenty of solid information presented in a very readable fashion.

2. Focus on the basics

JavaScript is a big language. It's probably bigger than some of the older languages at this point. I like to break the fundamentals down into 5 specific areas though when I'm teaching people brand new to the language.

- Variable declaration
- Function declaration
- Arrays and Objects
- Conditional statements
- Looping mechanisms

There's alot more, of course. But without these 5, you won't get anywhere because everything else essentially relies on these things.

You might think that these are simple and straightforward concepts that you can pick up in a few hours of reading online. But I assure you, there's more than enough content here to keep you busy for a while. There are many levels to even the most foundational parts of any programming language.

Let's take variable declarations as an example. Something like the following:

var name = 'steve';
var age = 30;

That's as much thought as most people will give to variable declaration. For the most part, it's pretty straightforward. You type var, followed by the name, followed by the value. Now let's introduce scope to the equation.

var name = 'amy';

function func1(){
    let local = 123;
    const pi = 3.14;

    pi = 5; // error
}

console.log(local); // undefined

With the ES6 variable scope declarations (var, let and const), you can control where any given variable can be used. var, for example, defines a global variable which can be used anywhere in a given script. Nothing has changed there. But let and const, both only declare variables in their given scope, meaning their given function or other block.

Continuing with variable declaration, as of ES6, you can also incorporate the destructuring assignment in order to extract values from a given array or object and to assign those values to a given named variable.

As I said above, there are many levels to the basics and it's in knowing those that inevitably make the whole learning process much easier.

1. Ignore everything else

As I said, JavaScript is a huge language. It's built up of thousands of predefined functions, interfaces and properties. That screenshot above, is just a tiny subset of the entire list of JavaScript interfaces. Some are experimental and aren't fully guaranteed to run on every single browser just yet, and others are deprecated. There is a good chance that deprecated functions in JavaScript however are still heavily used on production systems.

You don't need to know the entire list in order to be a proficient programmer. You might never encounter most of these ever in your career. So don't worry about reading the full documentation page on each and every one.

You should let the project that you are working on determine just how much knowledge you need on any particular language feature. By that I mean, if you need to verify an address for example in a form, then knowing how the Geolocation API works will be beneficial, but not really before then.

Last words

Don't worry if you are struggling to learn JavaScript right now in order to keep up with the latest and greatest frameworks. There is a process to this whole thing. And from what I have found in all of the years that I've spent coding, it starts with having the right tools and with knowing the fundamentals. Everything else takes care of itself.

Walter G. author of blog post
Walter Guevara is a Computer Scientist, software engineer, startup founder and previous mentor for a coding bootcamp. He has been creating software for the past 20 years.

Get the latest programming news directly in your inbox!

Have a question on this article?

You can leave me a question on this particular article (or any other really).

Ask a question

Community Comments

No comments posted yet

Add a comment