dev-consoleJavaScript is compact in that unlike many other programming languages, you don’t have to install a compiler or an interpreter to get it working. If you are running a web browser then you can already access a JavaScript console without installing anything else. In the case of Google Chrome and Mozilla Firebox simply pushing “control+shift+I” will bring up the developer tools panel (for windows Internet Explorer or Windows Edge, just push f12 or “control+2”). Each set of developer tools has a tab labeled console which allows you to write and execute JavaScript code. You may also use some of the other tabs to do other cool and useful things but we will leave them alone for now.

cloud9If you wish to develop in JavaScript past simply writing small pieces of code inside of your browser you also have many different online and offline options to choose from.   JS Bin, JSFiddle, and CodePen are some of the more popular online options. You may also choose one of the more fully featured cloud IDEs (integrated development environment) like Cloud9, Codenvy or CodeAnywhere.

If you want to develop JavaScript offline, then installing Node.JS and NPM (Node Package Manager) is a must these days. Node.Js gives you access to a server which will let you run your code. It also lets you access a metric ton of cool JavaScript frameworks, libraries, and development tools.

If you are looking to code along with this blog, I would recommend either finding a cloud IDE that you like or installing Node.js for your platform; click here to find the instructions for your operating system.  For Windows machines, you can use Chocolatey as a package manager or install Node through the executable found here. (Note: I recommend using Chocolatey because it sets up your PATH variables for you and you gain access to many different packages.)  You won’t really need Node or NPM to follow these tutorials (at least until we say so), most basic JavaScript work can be done through a browser console or by using something lightweight like CodePen or JSFiddle. You can also take a look at some of the offline options that we recommend here.

Let’s Start with Some Basic Coding!

JavaScipt is a Dynamic, Untyped, and Interpreted language with both Object-Oriented and Functional Programming paradigms baked into it.  As you read through our blog postings you will start to learn what some of this stuff means, but for right now its probably best just focus on the “Interpreted” part.

An interpreted language is a language which does not need to be compiled down to bytecode before being run.  The JavaScript Interpreter “translates” the code line by line at runtime rather than beforehand.  This is what allows for the JavaScript Console to work the way it does.  If I open up my JavaScript console and type something such as var x = "Hello, World!" then press the enter key, the console will spit back undefined. The reason we see undefined rather than "Hello, World!" is because assigning a variable has no return value (This isn’t important yet, just keep it in mind). In this really simple case, we are assigning the string Hello, World" to the variable x and the console is spitting back the return value of running a variable definition undefined.

If we type in just the string portion "Hello, World!", the console will spit back 'Hello, World!' and if we just enter x into the console we will now receive the string "Hello, World!" as well. What we’ve done is assign the value of the string "Hello, World!" to the variable x. The assignment of x can be changed (is mutable) and has a lifetime as long as the window or tab is open (once you close the window the console will clear all variable assignments.) You may also simply refresh your page to clear your data assignments from the console.

Closing

In this post, we wrote a fairly basic “program” which assigns a string to a variable. In our next post, we will go over the different types of data that can be assigned to variables in JavaScript, why it’s called an “untyped” language and some of the different ways that we can manipulate this data.