JavaScript: Here we go...

06 February 2016

So after painstakingly avoiding having to use JavaScript for many years I've finally had to use it for something.

JS Isn't a real language

Many Online Commentators

I'd heard various horror stories about how JS "Isn't a real language" and thankfully I'd never had to use it in anger, instead limiting myself to
messing around making boxes pop up on peoples browsers. But this time was different. Someone I know had asked if I could make an "web-based Animated Harry-Potter House style scoreboard". Once I'd fully understood what this person meant (some hourglasses with gems in on a webpage) I sat down to do some serious thinking.

I couldn't see an easy (read sub 50 lines) solution in Python or C++, my standard languages, so decided it was time to give JS a shot. How hard can it be right?

well

After settling down with W3schools and the official JavaScript docs for a while i decided to start trying to hack something together. After a couple of hours I had a reasonably working solution up on condepen and was feeling pretty happy with myself.

As a result I was just about to pronounce that JS was the greatest language ever and wonder why I ever learned anything else when I tried to improve on it. It seems there's a "pro" way to write JS and a "hacky" way. I had been using the Hacky way and to cut this article short rearranging my code to include some cooler features (such as animaitons) would have resulted in a complete restructure.

So what?

As a first foray into JS I think it was a success, but I learned a pretty valuable lesson with it. As with most languages it always takes a little more work than you think to have something that isn't just single use only. I'm going to work on re-coding the Harry Potter scores and put the full code up on codepen when I've got it re-useable enough.

The current Code is here: Code if you fancy a laugh or if you want to redo it for me!

DN