Be Dangerous: Just Enough JavaScript[0]

What is JavaScript?

Years ago, when I was just getting started in the world of computing as a professional (and we'll use that term loosely considering I was just out of college and was trying to escape my own collapsed freelance web design business) - I did my work primarily in HTML and PERL. However one of the ways I made a name for myself was by writing an early cross-browser JavaScript library for rendering, manipulating and animating web pages.

That helped me get my name out a bit more at the company I was at, but my Java friend who helped me get the job told me something I will remember to this day:

You really should stop wasting your time with that JavaScript stuff. There is no future in it.

It's now 2017 and JavaScript is a highly desired skill for not just animating things on web pages (for which I recommend velocity.js and not trying to unearth my code), but as server-side code and also for data management. You can write an entire application stack in JavaScript now, including the utilities to help maintain it.

There is also an old saying: some people know just enough to be dangerous.

I've never entirely understood why some people seem to take that as a bad thing.

So for the next few posts on this blog, I'm going to share some of my knowledge of JavaScript. It won't be a deep dive. It won't be the kind of thing you want to walk into an interview with.

But it might just enough to make someone comfortable.

Maybe a little dangerous.

So for this first post, I'm going to focus on a single question:

What is JavaScript?

And instead of trying to answer that in a single question, I will do it like I used to write FAQ's - in the style of a conversation.

So let's start again.

What is JavaScript?

It's an object oriented scripting language.

Great. What's a scripting language?

Computer languages come in two flavors (roughly) - languages meant to be compiled into a format and then run and languages meant to be run by another application, like a browser. JavaScript is the latter.

And what does object oriented mean?

Don't worry about that now, we'll get to it later. Just remember it is a way to organize how code is being run.

So it requires a browser?

Browsers are the traditional means of running JavaScript. It started as part of the Netscape web browser to make pages more dynamic and was originally called LiveScript until the name was changed abruptly when it came out of beta.

Why the name change?

It is generally assumed that it was a last minute marketing change by Netscape to cash in on the rise of Java, a completely different compiled language. Java developers have never really forgiven JavaScript developers for this.

So it has nothing to do with Java?

There are some incidental overlaps in grammar - but that isn't unsual between languages. In many ways they couldn't be more different. Java is a strongly typed compiled language designed to be usuable in a wide variety of platforms and environments, and JavaScript is a loosely typed scripting language originally intended to run in a single browser application.

There is a saying: Java is to JavaScript like Ham is to Hamster. That's not entirely accurate, but it's funny enough.

Strongly typed what?

Again, don't worry about that just yet. Just remember that they approach how to determine the value of something very differently.

It just runs in a browser?

Well, originally it was just a Netscape thing. Then this company called Microsoft (you might have heard of them) decided to compete directly with Netscape. Soon there were various intrepretations of how JavaScript should run in the browser and it pretty much made a compatibility mess which we are still cleaning up today.

That sounds terrible.

It was. Kinda still is. It also pretty much kept me employed for several years helping sort out the whole thing for companies, so I have somewhat mixed feelings about the whole thing.

What about this "full application stack in JavaScript" thing?

In 2009, this guy named Ryan Dahl had the crazy idea of using the engine Google was using to handle JavaScript and implement it as a web server. Apparently he stared into a file upload progress bar too long and started hallucinating that the same language used to change font colors might also be able to serve web pages or something. That project is now known as Node.js.

It also turns out that JavaScript's rather casual relationship with structure makes it useful for flexible data structures.

When you start combining all of this together, you get a language which is highly useful in many different scenarios. For instance, this blog is using a version of ghost - a blogging platform written in Node.js.

That's enough information for now. The next post will take two things:

How to install node.js and make it say hello

See you then.

comments powered by Disqus