A Brief Introduction to JavaScript: What Is JavaScript?

Take a moment and think back to a time where you visited a website, any website, and you thought to yourself, “This particular feature of this website is really slick! I love the way it does the thing it does!” Well, maybe not exactly like that, but you get the picture. That feature we hypothetically thought of, however, is probably in some way the work of JavaScript.

So, What IS JavaScript?

JavaScriptJavaScript is a high-level interpreted programming language that is one of the three core pillars of web technology (the others being HTML and CSS). JavaScript enables interactive web pages; all major web browsers have dedicated JavaScript engines in order to properly execute it. What this leads to is the idea that basically every website can, and does, use JavaScript in some capacity, and the browser on your computer does the work executing it.

This scripting language has been around since December of 1995, was originally written in 10 days, and supports event-driven, functional, and imperative programming styles, including object-oriented and prototype-based styles. This, in laymen’s terms, means that this language is able to be adapted to just about whatever problem it needs to solve, and can be written similarly to languages like Java (which, in fact, is not the same thing as JavaScript) or C++. JavaScript has become so widespread that, as of 2019, it has also been adapted to work as a server-side language, which means the server that hosts the data processes the JavaScript, rather than the browser on your computer.

JavaScript on the Web

So, now we know what JavaScript is, but what really is JavaScript? Well, for most of our readers, JavaScript is the programming language we use to create animations, user-interface interactions, and to ensure the data on your website appears efficiently. It’s also the language that Google leverages in order to allow your website to track analytics, to secure your forms through Google ReCaptcha, and so many more things. I personally like to refer to JavaScript, in our implementations at least, as the “polish” language: it’s what we use to finalize and improve the user experience and theme of your website with fluid animations, functionality like accordion sections and date-pickers, hidden menus, banner sliders, and basically any other interactive feature of your website.

To give it some perspective, as of May 2017, 94.5% of 10 million most popular web pages used JavaScript. A lot of the time, however, you wouldn’t even know JavaScript was being used (unless you knew what to look for). Take, for instance, posting to your social media network. When you create a post, generally, a popup window with the form to fill out appears for you to use—that box probably uses JavaScript to appear. Once you type in your post and click the “Post” button, JavaScript then sends that information to the social network’s server, which makes it public to the world. If your page didn’t reload after you pressed that button, then it’s definitely JavaScript running the show there.

And, at this point in the Internet and Web 2.0, JavaScript is doing a whole lot more than just interactive elements. As I mentioned above, JavaScript can also be run as a server-side language, much like Python, Java, or PHP. This means that not only can JavaScript move elements around on your website, create flashy animations and effects, and provide seamless transitions, but it can also interact with a database and provide server-side functionality, like creating sessions. With this in mind, it’s safe to say that JavaScript has all but taken over the internet and is in just about every internet-related interaction that you have daily.

Node.js - the de facto server-side implementation of JavaScript. Node.js – the de facto server-side implementation of JavaScript.

There are, however, several things that JavaScript CAN’T do in your browser. The biggest of these is JavaScript on a website does not have direct access to your operating system (OS) or to your file system, meaning that it cannot read/write arbitrary files or copy/execute programs. Now, this is muddied a little by the fact that modern browsers WILL let the JavaScript interact with files, but this is only the case when there is some user interaction to facilitate it (such as dropping a file over a webpage to upload it).

One of the few ways JavaScript can interact with your files is through user interaction - commonly seen in forms like this one. One of the few ways JavaScript can interact with your files is through user interaction – commonly seen in forms like this one.

One of the other major things JavaScript cannot do is access the other tabs on your browser unless they fall under the “Same Origin Policy,” meaning that they are both of the same protocol (http or https), same domain, and the same port. This means that if you enter information on one page, unless you’re on the exact same website on another page, the second page cannot use JavaScript to access the information you put into the first page.

These are two of the major things JavaScript can’t do, and they both are results of trying to secure your web browsing experience.

JavaScript is Unique and Powerful

JavaScript is a relatively unique language as well, having at least three features that make it different from other languages:

  • Full integration with HTML and CSS—the web-standard languages for displaying and styling data on websites.
  • The idea that simple things are completed with simple solutions.
  • And the fact that ALL major browsers support and enable it by default.

JavaScript has ALL of these features, which is what honestly makes it so unique. There isn’t any other browser technology (as of writing this post) that combines all three of these features. This is also why it is the de facto tool for creating browser interfaces.

Keep an eye out for the next installation in the Introduction to JavaScript blog series from the Armor Techs. In this one, we barely scratched the surface of what JavaScript is capable of. JavaScript is a magical, powerful scripting language that we interact with every single day through the internet, and as such, there is a TON of information about it. We’ll discuss some of the basic programming concepts in the next post, as well as some fun applications you might see on any Armor website.