One of the nice things about learning JavaScript these days is that there is a plethora of choices for writing and running JavaScript code. In this article, I’m going to describe a few of these environments and show you the environment I’ll be using in this series of articles.

Environment 1 — The Web Browser

The easiest way to run JavaScript is to simply use your web browser. You can either create an HTML page and put your JavaScript code inside a <script> tag, or you can use the browser’s developer tools to run your programs.

If you use HTML, here is a Hello, world! example to show you how your file should look (I’m skipping some HTML best practices to create a minimal system):

<!doctype html>
<html>
  <head>
  <script>
    alert("Hello, world!");
  </script>
  </head>
  <body>
  </body>
</html>

Save the file with a .html extension and then use the Open File command in your browser to load the page. “Hello, world!” will appear in a box in the browser.

The other way to run JavaScript programs in the browser is to use the browser’s developer tools. For Chrome and Firefox, if you press F12, the web developer console opens and you can input your programs here.

Look for the command prompt >>. Type your JavaScript commands there and hit Enter to have the browser evaluate your code.

Here is an example:

>> console.log("Hello, world!");
Hello, world!
-> undefined

undefined just means that the statement you ran didn’t assign a value to anything.

The Chrome browser’s developer tools work similarly.

#javascript-development #learning-to-cod #javascript #learning-to-program

Learning JavaScript: Development Environments for JavaScript Programming
2.45 GEEK