JavaScript without the Browser

Native Objects

Native objects are those objects that are part of the JavaScript programming language and are available in both Node.js and the Browser.

Host Objects

Host objects are those objects that are only available in a single environment. For example the DOM, or Document Object Model is not available in Node.js but are available in the Browser. Likewise, the host objects to access the local file system is not available in the Browser but are in Node.js.

0:00

Now you've seen a simple
example of a JavaScript program

0:03

running outside the browser.

0:05

Let's go into a little more detail
about what's available to you, and

0:08

what's not when writing
applications like this.

0:12

As developers, we use the JavaScript
programming language that's interpreted

0:17

and executed by the browser's engine
against browser specific APIs

0:22

like the DOM, or document object model.

0:25

When thinking about a JavaScript
program in the browser,

0:28

you can split it up into
two distinct parts.

0:31

Firstly, native objects.

0:33

These are the objects provided by
the JavaScript programming language,

0:37

objects like string, array,
date, math, and many more.

0:41

You can use these in any environment,
not just in the browser.

0:45

Secondly, host objects.

0:47

These are the objects
provided by the environment.

0:50

In the case of the browser, it's things
like Window, document, history, XMLHttpRequest,

0:55

HTTP request and many more.

0:57

As JavaScript became more in demand,

0:59

the performance of the JavaScript
engines became more important.

1:03

JavaScript started becoming
a more viable option

1:06

to build not just browser applications,
but all types of applications.