Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Preview
Start a free Courses trial
to watch this video
In this video, you'll learn more about what type of language JavaScript is, and how JavaScript code runs in the browser and other environments.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
[MUSIC]
0:00
Hi again.
0:04
In the previous stage,
you learned some of the history and
0:05
evolution of the JavaScript language and
the different flavors of JavaScript.
0:08
This stage is about exploring the tools
and workflows of JavaScript developers,
0:12
but first let's delve a little more into
what type of language JavaScript is, and
0:16
how JavaScript runs in the browser and
other environments.
0:21
JavaScript is a dynamic
programming language,
0:24
also referred to as a scripting language.
0:27
So what does it mean that
JavaScript is dynamic?
0:29
A dynamic programming language,
is a language that executes at runtime,
0:32
runtime meaning the period of
time which a program is running.
0:36
When you program,
0:40
you write sets of instructions
that tell a computer what to do.
0:41
In JavaScript, the instructions
are written for the runtime environment.
0:44
In a dynamic programming language,
like JavaScript,
0:48
you can manipulate almost everything
at runtime like creating new variables,
0:51
change the underlying type of a variable,
create new functions,
0:56
redefine existing functions,
load new scripts, and more.
0:59
There are different runtime
environments for JavaScript.
1:02
The most common way you can run
JavaScript is in a web browser.
1:05
Browsers have a built-in JavaScript
interpreter that reads, understands, and
1:08
runs the instructions in
a JavaScript program.
1:12
The interpreter is also referred to
as the browser's JavaScript engine.
1:15
Every browser has its own
implementation of a JavaScript engine.
1:19
For example, SpiderMonkey was
the first JavaScript engine,
1:23
which powered Netscape Navigator,
and today powers Firefox,
1:26
Chakra is the JavaScript engine for
Internet Explorer and
1:30
Microsoft Edge, and V8 is a powerful
open source engine for Google Chrome.
1:33
The job of the JavaScript engine is
to parse and execute JavaScript code.
1:38
It takes the JavaScript code you write and
converts it to fast optimized code
1:42
that can be interpreted by a browser,
all in the shortest possible time.
1:47
Modern JavaScript engines have
a built-in compiler called a JIT, or
1:50
just in time compiler.
1:55
It compiles your JavaScript
code into machine code, or
1:57
code specifically designed for
the browser, on the fly.
2:00
This makes JavaScript run faster by
monitoring the code as it's running,
2:03
resulting in performance improvements for
your applications, and
2:07
this process is also called
run-time compilation.
2:10
All of this happens almost instantly.
2:13
Once the code is produced by the
compilation process, the engine exposes
2:15
all of JavaScript's data types, operators,
objects, and functions to the browser.
2:20
While the browser is one of the most
common JavaScript runtime environments,
2:24
there are also other
non-browser environments,
2:29
Node.js being the most popular and
widely used.
2:32
You'll learn all about Node in
a later course, but if you want,
2:35
you can read a little more about Node,
and some of the other more technical bits
2:38
about how JavaScript code runs in
the teacher's notes with this video.
2:41
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up