Getting Started With JavaScript

Ben Wurth
CloudBoost
Published in
5 min readAug 24, 2017

--

A tiny primer for people who want to get started NOW.

Introduction

A lot of people are trying to get into programming right now for a bunch of different reasons. A great many of these prospective coders have chosen JavaScript as their starting point, and for good reason: JavaScript is easy to learn, fairly robust, and (most importantly) very popular with the cool kids. But it can be hard to transition from the tutorials into the real world, and some people just want to get started writing their own programs RIGHT NOW but don’t know where to begin.

With that in mind, I’ve compiled a short list of 3 ways that you too can get started writing your own programs. The list is sorted from easiest to hardest and there are some additional resources at the end. So without further to do, let’s get started…

1. On A Website

The fastest way to get started programming JavaScript is with an online coding sandbox. These websites give you an online code editor and allow you to see your results in real time. Like everything else in the JavaScript world, there are far too many choices. Off the top of my head, there’s JSBin, JSFiddle, Plunker, Codepen, Codesandbox and JS.do.

I have no real preference for any of these. But I think that the mascot for JSBin is cute, so I’ll recommend that to you. I’ve even started a quick “Hello, World” project that you can hack on to your heart’s content.

2. Directly In The Browser

If you want to step up your game, you can graduate from online sandboxes to executing code directly in the browser. Create a new html file with your editor of choice and paste the following code into it:

Then, save the file and open it with Google Chrome. Open Chrome’s developer tools by clicking on the menu button in the top-right corner, and going to More Tools > Developer Tools. From there, you can click on the Console Tab and see the output of your program.

This is enough to get you started, but the Chrome Dev Tools are a lot more powerful than this. You could even use Chrome as a full IDE if you really wanted to.

3. On Your Computer

You’ve tried writing JavaScript in the browser, but you aren’t having any of it. You don’t want to write websites. You want to write programs. In that case, node.js is for you.

Node.js allows you to write JavaScript code that you can execute directly on your computer. This means that you can do things like read and write files, access databases and interface with other programs on your computer.

Install node from the directions on their website and open up your terminal. Make a new file (call it index.js why not?) and write and save your code in it. Then in your terminal navigate to the file’s directory and run

> node index.js

and node will execute your code and print the output to the terminal.

Some Additional Questions You May Or May Not Have

What Should I Program?

Ultimately, it’s up to you. If you’re having trouble figuring out where to begin, here are a few challenges for you:

  • Make a program that asks the user their name and age and then politely prints that information back to them. (You get bonus points for selling the information to Google)
  • Make a program that plays Fizz buzz (an old programmer favorite).
  • Perform the Fibonacci sequence up to 100 values.
  • Make a working calculator. Figure out how to get input from the console and make a program that takes a first number, an operator (+, -, *, /) and a second number, and output the result.
  • Make a text adventure game. Describe a setting to your user and allow them to move around and interact with objects. Maybe like a pumpkin. Or some parapets.

Here are a few more JavaScript challenges.

Is This Really All I Need To Program In JavaScript?

Yes.

Well, no… Not really. It’s enough to get you started, for sure. Enough to allow you to play around with the language and see how it works. If you want to do something useful with JavaScript, you’ll probably have to bring in some more advanced skills and techniques.

I recommend starting a small programming project of your own design and seeing it through to completion. The skills and knowledge you’ll learn along the way will be invaluable and give you a good idea of what’s involved in a larger project.

What Happens If I Get Stuck?

Every thirteen years the old gods of blood and bone give Man a new gift to carry him through the dark times ahead. In 2008 they gave us StackOverflow.com. If you run into a problem programming, the odds are that someone else has already had the problem and posted it on the site. It’s also likely that someone else has answered the problem clearly and concisely. You may want to try and solve the problem yourself, first. But if things get hairy, the solution is only a Google search away.

I’m Tired Of Your Games, Old Man. I’m Ready To Take This To The Next Level!

Well, you might be interested in games, then. Udacity has a cool course on making HTML5 games with JavaScript. They also have a course on Interactive 3D Graphics that’s taught using JavaScript. Technically you can program Unity games in JavaScript, but I would highly recommend just learning C# instead. Take heart, though. There are many other JavaScript game engines to choose from.

If you want to make cool websites, you may be interested in front-end frameworks like React, Angular and Vue.js. If you want to make apps for your computer, you should look into Electron and NW.js. If you want to make mobile apps with JavaScript, check out Phonegap or Ionic.

I would recommend lurking around the JavaScript subreddit and the Stackoverflow JavaScript tag. If you still need more JavaScript, there’s a whole awesome list of JavaScript-related things on GitHub.

Conclusion

JavaScript is a great language to start with, but that doesn’t necessarily mean that its easy. You’ll have to pay your dues just like everyone else. The good news is that it’s easy to get started, and there are a bunch of resources to help you if you get stuck. I wish you the best on your programming journey!

Ben Wurth is a Software Developer at CraftingBytes. He spends his free time working on cool software and video projects and only has time to be silly once a week.

--

--