Be sure to check out the first post in this series, What is Computer Science?
JavaScript: it’s the Internet’s most popular coding language, used to build 95% of websites that are live today. And JavaScript’s popularity isn’t slowing down; about one third of programming-related jobs available require proficiency in the language. Obviously, JavaScript is an integral part of computer science, but what does JavaScript actually do? In this post, we explore the basics of JavaScript, the history behind the language, and some cool things you can build with it.
JavaScript is a programming language that allows you to code interactive content, control multimedia (like videos, photos, etc.), and create animations. It generally makes up the 3rd “layer” of web or app design. JavaScript is a dynamic coding language; it enables a developer to show different things in different circumstances based on the actions of the end user. For example, JavaScript can pull from large data sets to create a custom graph or show directions on a map. On the other hand, HTML and CSS are static coding languages; developers use them to show the same things all the time.
unctions are the backbone of JavaScript programs. Functions use coding core concepts like branching (2), loops (5), and variables (4) to create all of the functionality we see on websites. Functions can house variables, which are flexible storage containers for many different data types. Let’s take a look at some of the most common types:
(For examples of 1-5, see image to the left.)
The flexibility of JavaScript has fueled its rise to the most widely used browser language today.
The dawn of the mid-1990s brought the battle of the web browsers, and it was a fight for Internet dominance. In one corner, we had Microsoft’s Internet Explorer; in the other, was Netscape’s Navigator. Both browsers were innovating quickly, trying to become the fastest, most trustworthy, and most user-friendly option for end users.
In September 1995, programmer Brandan Eich turned the tide. He started as a developer for Netscape, specializing in Java and Scheme, but saw the need for a simpler language: one that could be used directly in a web browser. Thus, Brandon developed a brand new scripting language in only 10 days.
This new language was originally called Mocha, then LiveScript, but amidst all the name changes, Brandon realized that Java was still the most dominant programming language. As a result, he settled on the name JavaScript to position the new language in the same realm as Java. JavaScript and Java are incredibly different, so was the name just a marketing tactic? Maybe, but it was certainly successful. Today, JavaScript is used across many different areas of development.
Since JavaScript is the most widely used browser language, you’ve definitely run into things that are built with it in your daily life. Here are three interesting and recognizable technologies that include JavaScript.
When Netflix made the switch from DVD rentals to streaming in 2007, the website gained popularity like never before. People flocking to the service began to notice that the website was slow. Originally, the server hosting Netflix used Java, and the web browser used JavaScript. Every time a user visited netflix.com, the server created a response that added JavaScript to the website. In 2015, Netflix converted the platform to universal JavaScript, making the server response unnecessary. Load times improved by 70%, making it possible for to binge all the shows you want, as fast as you can!
Candy Crush, created by King Digital Entertainment, got its start in 2012 as a free browser game through Facebook. When it came to adapting the game for a mobile application, King Digital turned to none other than JavaScript. JavaScript allowed the developers to create an app that looked and performed the same way as the Facebook game. Even better, King Digital used a JavaScript framework to link the app to Facebook, allowing users to share high scores with friends. This wildly successful model inspired many other mobile games, including Bejeweled and Zookeeper Battle.
Sure, JavaScript can be used to create websites, but it can also be used to fly drones! Using React, an open source JavaScript library, and Node.js, a program that runs JavaScript, you can control drones using your browser. Wes Bos, a JavaScript developer based in Canada, created a two-part video series walking through how to fly a DJI Tello drone. This is a super niche application of JavaScript and worth a try for any hardware lovers out there!
That’s the background you need to get started with JavaScript, and there’s still so much more to explore. With the popularity of JavaScript here to stay and many jobs available to those that master it, there is endless opportunity for students that want to learn.
When you’re ready to take your students’ JavaScript knowledge to the next level, explore our course Programming 105: Introduction to Web Development with JavaScript.