Home Blog Frontend Technologies

What is JavaScript

Published:


JavaScript is a high level dynamic, untyped and interpreted programming language standardized in the ECMAScript language specification, that alongside HTML and CSS is one of the three core technologies of world wide web content.

To understand what JavaScript is we need to observe it in its natural environment - the web browser.

Consider a modern web page with great content, fancy design and layout, and advanced interactivity. What you see is the combined output of three distinct layers of code, put together by the browser. The first layer is the HTML document. This is where the content lives, marked up in a language that makes it easy for the browser to parse. When you visit a webpage you're accessing this document. And without this HTML document there's no web page. The second layer is a collection of CSS Rules.

This is the code that instructs the browser how to display the HTML Markup. HTML and CSS work together to insure a perfect separation of concerns. HTML handles the content. CSS is presentation. That means, even if you take the CSS away the content is still there. CSS is the presentational enhancement. The third layer is the JavaScript. What I call the interactive layer. JavaScript is a scripting language that runs in the browser and interacts with the HTML Markup and CSS Rules to change what you see and what you can do.

Technically you should be able to take the JavaScript away and still be able to access the content. But in recent years this has become less of a certainty. More on that later in the course. When you point your browser at an address with an HTML document, it first pulls down the HTML and indexes its content. Then downloads any CSS and JavaScript documents referenced, runs the JavaScript to see if any of the HTML Markup has changed, applies the CSS to make everything look the way it's supposed to, and finally leaves the JavaScript running in the background, in case an interaction or event triggers further scripts.

So in short, JavaScript is a scripting language that allows you to write small programs that run in the browser, and change the HTML and CSS of the current document. Of course, it's a bit more complicated than that, but this is a good way to think about it as you get started.

added on 03-Feb-2018
Comment