What is JavaScript? - Function & Uses

Lesson Transcript
Instructor: Kevin Newton

Kevin has edited encyclopedias, taught history, and has an MA in Islamic law/finance. He has since founded his own financial advice firm, Newton Analytical.

In order to build today's websites, you'll need to know more than just HTML. This lesson introduces you to JavaScript, which allows you to put code into your websites to increase their functionality.

What Is Javascript?

If you looked at a website designed in the 1990s, they could do some pretty interesting things for the time. These websites had different fonts, had numerous pictures, and even a short repeating cartoon of a dancing baby. For a world that was just getting used to the idea of the world wide web, this was a pretty big deal. Fast forward 20 years, and the only dancing babies you are likely to see are those that are part of a video with a cat. Indeed, the web has changed greatly over the past several years, and a major part of that change has been as a result of JavaScript, the programming language that lets you insert bits of code into a website to make pages more versatile.

In this lesson, we're going to learn more about JavaScript and see why you should even consider learning how to use it in your own sites.

An error occurred trying to load this video.

Try refreshing the page, or contact customer support.

Coming up next: What is Programming Language? - Types & Examples

You're on a roll. Keep up the good work!

Take Quiz Watch Next Lesson
 Replay
Your next lesson will play in 10 seconds
  • 0:03 What Is JavaScript?
  • 0:49 Where Does It Fit In?
  • 1:54 Example
  • 2:46 Why Bother Learning It?
  • 3:53 Lesson Summary
Save Save Save

Want to watch this again later?

Log in or sign up to add this lesson to a Custom Course.

Log in or Sign up

Timeline
Autoplay
Autoplay
Speed Speed

Where Does It Fit In?

For many websites, it is useful to think of them as a building: the frame of the house is HTML. It is a markup language that provides what a website needs to function. HTML gives you the roof, floor, walls, and framing to hold it all together. However, it's not that attractive by itself. In fact, it's sort of 90s-ish in design. To make things prettier, we use CSS, which are instructions to the website to present certain aspects in a certain graphical way. CSS, which stands for cascading style sheets, tell your website what colors, fonts, and sizes to use for text, as well as how to display different images. If a website is a building, CSS is all the painting, brickwork, and landscaping to make it worthwhile.

Here's where JavaScript fits in. JavaScript allows you to run different programs on your website, such as polls, quizzes, and much more. Everything from advertisements to simple games can be written in JavaScript. It is often what brings function to a website, so it's similar to the store that may exist on the first floor of a building.

Example

Let's take a look at how these three parts fit together and the role that JavaScript plays. Let's say you were building a dating website. After all, those make plenty of money, right? The HTML would be the core of the site: it would provide all the text that would appear, and it would break it up into paragraphs. It would also contain the raw image files of the happy couples you have scattered throughout your site. The CSS, on the other hand, would make it all fit together. It would make sure that your text doesn't obscure the faces of the happy couple, and make it easy for your visitors to figure out how to sign up.

To unlock this lesson you must be a Study.com Member.
Create your account

Register to view this lesson

Are you a student or a teacher?

Unlock Your Education

See for yourself why 30 million people use Study.com

Become a Study.com member and start learning now.
Become a Member  Back
What teachers are saying about Study.com
Try it now
Create an account to start this course today
Used by over 30 million students worldwide
Create an account