DEV Community

Aniket Chauhan
Aniket Chauhan

Posted on

How you’re going to write JavaScript

JavaScript is fairly unique in the programming world. With your typical
programming language you have to write it, compile it, link it and deploy
it. JavaScript is much more fluid and flexible. With JavaScript all you
need to do is write JavaScript right into your page, and then load it into a
browser. From there, the browser will happily begin executing your code.
Let’s take a closer look at how this works:

Writing

You create your page
just like you always do,
with HTML content and
CSS style. And you also
include JavaScript in
your page. As you’ll see,
just like HTML and CSS,
you can put everything
together in one file, or
you can place JavaScript
in its own file, to be
included in your page.

Loading

Point your browser to your
page, just as you always
do. When the browser sees
code, it starts parsing it
immediately, getting ready
to execute it. Note that
like HTML and CSS, if the
browser sees errors in your
code, it will do its best to
keep moving and reading
more JavaScript, HTML and
CSS. The last thing it wants
to do is not be able to give
the user a page to see.

Executing

The browser starts
executing your code as
soon as it encounters it in
your page, and continues
executing it for the lifetime
of your page. Unlike early
versions of JavaScript,
today’s JavaScript is
a powerhouse, using
advanced compilation
techniques to execute
your code at nearly the
same speed as many native
programming languages.

I hope you’ll find this article useful,
Thank you for reading.

Discussion (0)