Introduction to JavaScript

It's very common to see JavaScript referred to as one of the three core languages of web pages.

html css javascript

  1. HTML markup language for content and structure. What's your headline, how many divisions are in your page, how many paragraphs do you have, what are the contents of those paragraphs?
  2. CSS, the style sheet language, for presentation. What font does the headline use, what's the background color of the page, what's the width of the div that the paragraphs are in?
  3. JavaScript, the programming language for your behavior and interactivity. What happens when you mouse over a menu, what happens when you type the wrong value in a form field, how long does a photo slideshow take to move from one image to the next?

What is a Scripting Language

JavaScript is a programming language that you often hear it referred to as a scripting language, and sometimes you hear some software developers dismiss JavaScript as just being a scripting language.

This is because JavaScript is intentionally limited, so we can't write a desktop application in JavaScript the way we might do with C++, Java, .NET etc. JavaScript only works inside another application, the web browser. Whether that's IE or Safari or Firefox or Chrome or Opera, they all have a JavaScript engine inside them. The operating system runs the web browser, the web browser contains a page, and the page contains the JavaScript. Now another way JavaScript is limited is that yes, it doesn't have access to the file system of the computer that it's running on. There are no words in JavaScript to open or save local files because that would be a security risk.

There are no words in JavaScript to talk to a database or target a USB port. And that strikes some software developers as odd because most languages are all about input and output, and JavaScript isn't. But of course, they're missing the point. JavaScript wasn't designed as a general purpose programming language; it was designed to manipulate web pages and it does that very well.