ProgrammingJavascriptCareerProductivityGadgetsASP.NETWeb Design
fast, lightweight and runs in your browser

Javascript Is Perfect For Beginning Programmers

Written by
Published on
Modified on
Filed under
Javascript Is Perfect For Beginning Programmers

I get asked this question alot from many people who want to learn to program. What programming language should I start learning first? And what is the best approach? And normally I shoot out an answer that I think makes sense in the moment and then I don't give it a second thought. My usual answer is "check out C#, it's great blah blah blah" and I leave it at that. I totally ignore the fact that the other person has no clue what I'm saying and has no clue on how to get started. I actually did that recently to a co-worker who was interested in learning to code and they nodded and agreed and 1 month later they told me they had not yet started. It wasn't because they were lazy or because they were just making conversation when they told me that they wanted to learn to program. It was because my advice was the worst. It's like asking a martial artist to teach you a few things and he just stands there and says "kung fu..whoa".

"Which language should I learn?"
"They're all pretty neat I guess -_- "

So this time around I actually gave it some thought and I think I have a better answer. As you can tell by my spoiler title, my answer is JavaScript. Some people will tell you that it doesn't matter what language you start off with, but what matters is how you use it, etc etc. Sounds great and all, but if you're starting off you probably have no idea how you want to use it. You probably just want to type some code and see it spit out cool results. And JavaScript is the only language that I know that can accomplish that in less time than it took me to write this sentence. It's one of the few languages that just runs. You can jump into any website ever, and type a few lines pretty much anywhere and you're done. And that's a powerful thing.

It's my go to language whenever I'm trying something new for the first time for that very reason. A few months back I was working on an Android game and after a few hours spent attempting to setup the IDE I gave up and started making the game in JavaScript. There was 0 setup time and I had functioning code within minutes. I didn't have to wait for a compiler or anything, it just worked.

Why is it so good?

This is why it's ideal for newcomers. Because you don't have to worry about setting up a programming environment and a database and about installing modules on servers. All you have to worry about from step #1 is variables and function calls. For example, here is your development environment with JavaScript:

And here it is with Visual Studio 2013:

That's not to say that Visual Studio is full of fluff and useless tools, because that's not the case at all. If you're working on a full .NET web site you'll probably make use of most of the things that you see in the screen above. But, if you're brand new to the whole scene and probably don't have a deadline next week, then notepad just seems much more appealing, particularly because everyone knows what notepad is.

It's syntax follows the same conventions as c++, c# and php and it offers many of the same features. Which makes transitioning to a higher level language that much easier. Loops and conditional statements are one to one with other languages, you have Objects and Arrays which are also treated like their higher level counterparts.

Not that there's anything wrong with languages like C# and VB.NET. I first learned to program in C++ then moved on to Java and finally got to try C#. That process took years however and now I realize that a good portion of that was learning the development environment. For example when I was learning C++ in college, I probably went through a dozen C++ compilers on Windows, and then ended the course by moving over to C++ programming in Unix. Those things don't become too important when programming in the real world. Every company you will work for will have their own programming environments and you just have to get used to it each time.

With JavaScript, you don't have to install or setup anything. You more than likely already have a browser, and if not, then maybe programming isn't for you. You have notepad installed by default like always pretty much. And now you can focus solely on learning the syntax, and not on trivial issues like configuration errors and package managers and such.

Here's a pretty basic webpage with some JavaScript thrown into the mix. We have a function definition, a for loop, a conditional statement and we're calling the pre-defined getElementById to grab our html element.


<html>
<head>
<script type="text/javascript">
function func1()
{
for(var x = 0;x < 5;x++)
{
if (x != 3)
	document.getElementById("div1").innerHTML += "

Javascript sure is simple: " + x + "

"; } } window.onload = func1; </script> </head> <body> <div id="div1"></div> </body> </html>

You can copy and paste that into a text file, save it as a .html file and your done. If I were showing how to accomplish this in Visual Studio, we'd still be in the pre-compilation phase and page life cycle and anybody new to programming would of had ZzZ's floating above their head.

JavaScript Is The Odd Kid In The Classroom

JavaScript is a powerful and lightweight language that runs the internet pretty much and I wish that more educational institutes would make better use of it instead of teaching archaic scripts written in 1970's. When I was in college I learned assembly language, c, c++ and java. After college I never saw any of those languages ever again. JavaScript isn't very "sciency". It's functional. It works. It's clean. That doesn't really look good in a classroom. Slow, grimy and garbage collectiony sells however. I know that when I was in school that's how I took software development to be. It was this old and cool thing that only you could read with a handful of people could write, and we liked it that way.

Move forward 7 years and JavaScript has evolved exponentially. At least it's abilities have. But it's still that cool and clean language that I remember reading about in the past. For that reason I continue to learn about it and use it on daily basis. And from now on when someone asks me which language they should pick up first, I can quickly tell them to fire up their notepads and get to typing.

Walter Guevara is a software engineer, startup founder and currently teaches programming for a coding bootcamp. He is currently building things that don't yet exist.

Comments

No messages posted yet

Developer Poll

Q:

Stay up to date

Sign up for my FREE newsletter. Get informed of the latest happenings in the programming world.

Add a comment

Keep me up to date on the latest programming news
Add Comment

Stay up to date

Get informed of the latest happenings in the programming world.

No thanks