JavaScript

Learn JavaScript. Here’s how to get started.

WebsitesCategory
5 min read
Tom Ewer

API-powered JavaScript applications are the future of WordPress and the Internet — that was the key message of the State of the Word 2015. Matt Mullenweg left the WordPress community with one piece of homework: “Learn JavaScript, deeply.”

Calypso already hinted at it and now it’s official: the time has come for WordPress developers to branch out.

With PHP long being the staple of WordPress professionals, not everyone feels comfortable with the shift; even the Automattic team admitted to find it challenging. Yet, avoidance has never solved anything. So instead of retreating, we are going to face this head on.

In this article I will give you an introduction into what JavaScript is and can do, its current and future applications in WordPress, and resources that will help you to start learning now.

Go from idea to online in minutes with GoDaddy Airo™

Get started now.

JavaScript: The essentials

JavaScript is a client-side programming language — meaning in contrast to languages like PHP, it is run and interpreted in the browser, not on the server. It was created in 1995 and is by now the most popular language on GitHub. Users include Facebook, Google, YouTube and Pinterest.

JavaScript on GitHut

One of its main advantages is that as a front end language, JavaScript can work faster and reduces server load.

JavaScript is also extremely versatile because it works well with other programming languages. It can basically be inserted into any type of web page regardless of file extension and is natively supported by all major browsers.

The downsides

However, its front-end character makes it very dependent on the user environment. Should someone have JavaScript disabled in their browser (seldom as that may be these days), it won’t do a thing. Different browsers also tend to render JavaScript differently, making extensive cross-browser testing necessary. Furthermore, the markup generated by JavaScript is not always readable by search engines.

Despite these disadvantages, the language is used on many websites — traditionally to add animations and effects, load functionality without reloading, and increase the interactivity of web pages.

JavaScript frameworks

By now, there are many JavaScript frameworks that make building JavaScript apps more efficient than writing from scratch. Which one is the best is an endless point of contention, so I will only talk about the leading ones:

  • Backbone.js is the oldest JavaScript framework. It’s part of WordPress Core and can be found in themes as well.
  • AngularJS is an open-source framework maintained by Google for single-page apps. People already play around with Angular and the WP REST API.
  • React is a JavaScript library by Facebook with the accompanying Relay framework. Part of Calypso, other users include Netflix and Airbnb.

Current applications of JavaScript in WordPress

WordPress already uses JavaScript, particularly jQuery, Backbone and Masonry. The theme customizer in particular relies on it, along with things like drag-and-drop widgets. You can find a partial list of available scripts here.

The language is also present in many themes and plugins, especially sliders, galleries and social media buttons.

What we will likely see from JavaScript in WordPress

Much of what we can expect goes hand in hand with the WP REST API, which opens up WordPress to JavaScript frameworks. A likely result of this is JavaScript front ends on top of a WordPress database. You can already see examples of this today, including entire applications. A new breed of JavaScript-first plugins to work within these applications is also a probable result.

Besides the above, we can prepare for custom WordPress admin interfaces and apps akin to Calypso.

How to learn JavaScript

As you can see, learning JavaScript is an excellent idea. But how should you get started? As with most things in life, there is no one right answer.

Diving into a framework will enable you to build things more quickly, but probably won’t give you a very deep understanding of JavaScript. If you are fine with that, have at it! However, learning the language from the ground up might do more for you as a web developer, and there are plenty of structured learning resources to help you do so.

The following resources can help you hit the ground running and start learning JavaScript now:

Online Resources

The excellent collection How to Learn JavaScript Properly combines material from around the web into two cohesive six- to eight-week courses — one for beginners and one for experienced developers. For something more practical that has you writing code right away, check Codecademy.

Books

JavaScript The Good Parts

In the book department, JavaScript – The Good Parts offers an 80/20 approach to learning the programming language. Its big brother, JavaScript – The Definitive Guide, is a great reference guide.

For more free books on JavaScript, swing by JSbooks.

Videos

Visual learners can find on-demand video lessons for beginners, intermediate and advanced users at Frontend Masters. An alternative is Treehouse, and you can also find free stuff on YouTube.

Podcasts

The JavaScript Jabber podcast will keep you up-to-date on the latest developments and has a huge backlog. Also check out JavaScript Weekly — a curated newsletter published every Friday

Conclusion

The WordPress platform’s shift towards JavaScript presents a challenge to developers, pushing many to dive into a new programming language. Fortunately, they don’t actually start from zero and can transfer much of their existing experience.

In addition, the web offers many high-quality learning resources for those making the switch. The resources mentioned in this article represent just the tip of the iceberg. Pick the material that most appeals to you and you have already taken the first step. The rest will evolve naturally from here.

Are you planning to learn JavaScript anytime soon, and if so, what’s your approach? Let us know in the comments section below!