Let's take a look at a term that I'm sure you've heard but you may not understand what
it is and you may have actually misused it as well.
The term is JavaScript.
So, what is JavaScript?
JavaScript is a programming language and it's mostly used to script webpages.
So it basically makes webpages interactive.
For the most part without JavaScript webpages would be static.
In other words there would just be text and images on there.
Nothing would move and nothing would really interact with you.
Menus wouldn't popup.
They wouldn't have any intelligence behind them.
They would just basically be like a page in a book.
Now JavaScript is not Java.
This is where a lot of people misuse it.
They think they're either the same thing or they're are related.
But as you can see here there are a lot of words that sometimes seem similar and they're
not related.
JavaScript is definitely not Java.
Java is a programming language also but it is used for different things and in different
ways.
It used to be used sometimes on the web, and occasionally still is, but as a completely
separate element on a page and it's used to build apps particularly for android devices.
But JavaScript is a different programming language entirely with very different uses.
So not only maybe have you have misused it by saying, oh should I have Java enabled for
this webpage or does this webpage use Java or something like that.
But it is very commonly misused by recruiters for jobs when they are seeking out somebody
who does either Java or JavaScript.
They put the opposite in a posting for a job.
So you should keep in mind that Java and JavaScript are separate programming languages used for
separate things in separate ways.
Now there are three core web technologies and they are HTML, CSS, and JavaScript.
Basically HTML relates to content.
The content on the page, the text, the images, things like that.
CSS is the design of the page.
How things look.
What fonts are used.
How far items are spaced and where they are.
JavaScript is everything that is interactive.
Everything that moves, everything that interacts with the cursor and everything on the screen.
These aren't exclusive.
As a matter of fact all three of these can be used for all three things.
You can include design elements and interaction in HTML just as well as you can include content
and design in JavaScript.
But for the most part this kind of defines, for people that are not in the business, what
each of these three things does on a webpage.
So let's take a look at some JavaScript.
The first things I want to do is I want to bring up Safari's Preferences.
In Safari Preferences under Security there is the checkbox for Enable JavaScript.
So from time to time if you hear somebody say to be very secure online you have to turn
this off.
If you turn this off basically you're going to disable most of what goes on the internet.
Webpages will either not work or work completely differently with JavaScript off.
It's really not possible to turn JavaScript off and browse the web nowadays.
But that option is still there and this is again where people a lot of times misuse it.
They'll say I've disabled Java and what they mean is JavaScript.
Now in addition to that let's take a look at what's in JavaScript looks like.
So I've used here in Safari, I've turned on under Preferences the Develop menu which is
something only a developer really needs to do.
I've been able to bring up the coding for the webpage.
You can see it here.
I've highlighted a bit of code and sometimes JavaScript is just used like this.
A simple tiny piece of code in the HTML of a webpage.
In this case it's a piece of code that's going to output the current year.
So there's a copyright message and it will always put the current year.
You don't have to update the webpage.
But in addition to that you'll find either longer scripts or scripts that actually, here's
an example of a longer script on this page, so you can see there's a bunch of stuff here.
Sometimes we'll see it where it's like this.
It's actually referencing a file that has some code in it.
So HTML can actually have the JavaScript scripting code in the page or it could be in a separate
file.
This is basically, you know what a lot of JavaScript looks like here, but it's really
not important unless you're a programmer.
Just knowing that the interaction is part of what's part of the webpage is all you need
to know.
But you can also find JavaScript in other places because other apps beside web browsers
will use JavaScript.
As a matter of fact you can use JavaScript in Automator.
So here I've created a new Automator document and you can see I can actually add a Run JavaScript
element here and I can actually type JavaScript, sometimes called JXA in this context.
J for JavaScript.
I can program and do things with the elements in my Mac using JavaScript.
So, JavaScript is used other places.
Sometimes for game programming, sometimes other types of documents will have JavaScript
script in them to do some interactive kinds of things.
So it's a very valuable skill for programmers to have now and you'll see it used, pretty
much, everywhere in all different types of things you do online and with computers.