You may be cringing at that title, and trust me: I know just why.
So what is Javascript? According to its creator it is a programming language that was hacked together to allow client side image replacement on web pages. Its main purpose today is to make web pages dynamic (read "ridiculously awesome/glorious/{insert positive adjective here}"). My python-savvy back end colleagues like to make jokes about how terrible Javascript is, and even its creator Brendan Eich does so sometimes.
Twitter discussion about Javascript on its 22nd anniversary@attentive @thelastinstance The 't' in JavaScript stands for "trouble"!
— BrendanEich (@BrendanEich) May 15, 2017
FYI the goal wasn't popups, rather client side image replacement shirt-in-catalog color picker.
In the same thread he admits that it took him 10 days to create it, that some of the bad parts came as feature requests and he takes the blame for agreeing to them.
You might be wondering why I'm rooting for it if it's so atrocious. Well, after 22 years of existence it is now one of the most versatile and popular programming languages in the world, riding the technological waves made by web browsers; you can do pretty much anything with it. It is my intention to convince you of how worthwhile it is to learn and/or teach Javascript to anyone willing to learn, especially children. Allow me to walk you through 8 awesome things you can do with Javascript.
1. Awesome User Interfaces
The main function of Javascript is powering user interfaces: it's almost true to say that where there's a screen, there's Javascript! Apart from being used on websites, it's also implemented in televisions, ATMs, phones and even in cars. Not bad, right? Think of all those possibilities and employment opportunities. (Ka-ching!)
2. Games!
This is by far my favorite on this list; the introduction of the canvas element to html has opened up whole new possibilities. Among those is the possibility to make HTML5 games. Before the canvas era, one had to learn Actionscript and use flash technology to make highly interactive games for the web. Now you can just use Javascript with no browser plugins required. There are plenty of game engines to chose from (some don't even require programming skills), and you can even make 3D games! How cool is that?
Examples:
3. Art
If you are the artsy type you can also create your next audiovisual masterpiece using Javascript. Check out this cool talk to see some of the possibilities. If this 8-bit masterpiece doesn't entice you I don't know what will.
Examples:
4. Server applications
That's right. Javascript can also be run on the back end thanks to the great work by the people over at Node.js. In fact, top tech companies like Nextflix, Uber and Groupon use nodejs on their servers. I once mentioned using Javascript on back end to a Java developer colleague. His reaction was to laugh and point out how unsafe it would be, since everyone would be able to see all your code. He was clearly imagining publicly available Javascript code running in the browser, as opposed to remote code running on a secure server.
Some companies that use Node.js:
5. Mobile applications
One of the challenges of developing mobile apps is that different mobile operating systems run on different technologies. With projects like phonegap it is possible to use Javascript to make apps that, without any changes to the code, will run on multiple mobile operating systems, write once run anywhere. Sounds like a sweet deal, doesn't it? Time to conquer that app store.
Examples:
- Sworkit (android, ios) fitness app
- Instagram (android, ios) – at the time of writing, Instagram is built on react-native
6. Desktop applications
Like mobile applications, in order to create applications for different operating systems (macOS, windows, Linux etc.) one would normally have to use different technologies, but thanks to projects like electron you can make cross-platform native desktop applications in Javascript! Check out these sweet desktop applications made using Javascript. I use 4 of these everyday.
Examples:
- visual studio code, Javascript IDE built on Javascript
- Franz, helps you keep track of all your social media without getting overwhelmed
7. Embedded devices
For those who like hacking away on hardware projects, whether it's making fingerprint operated locks or motion-triggered nightlights, you can now do this in Javascript. Projects like Espruino make this possible.
Examples:
8. Virtual reality
Nowadays virtual and augmented reality technologies are all the rage, with top companies investing billions into this industry. Guess what, you can make virtual reality applications using Javascript thanks to the open standard of webvr, which brings virtual reality to the browser.
Examples:
Other (ahem) possibilities
People are always trying to find new ways to use Javascript because it's so popular. Here are some of the most interesting I came across:
- Want to control satellites? Use Javascript.
- Do you love visualizing data and creating mind blowing charts? Check this out.
- Want to control self-conscious (often murderous) robots? Use Javascript! There is a whole thread about this here.
Screen from HBO's Westworld series
I know Javascript has its issues eg. NaN(not a number) is actually a number but is not equal to anything, not even itself! When used properly it has great potential – you know what they say about great power and great responsibility.
“Any application that can be written in JavaScript, will eventually be written in JavaScript.” — Atwood’s Law
So, why Javascript?
Whatever you opinion may be on the matter, Javascript is undoubtedly an awesome superpower to have in a digital craftsman's toolbox, and it's all free! As an ECE graduate, Javascript was not my first contact with programming (BASIC was the first language I worked with) but I will never forget how magical it felt when I got around to learning it and all the cool things you can do with it. I can only imagine how it would have felt if my first time had been with Javascript.
You want to change the world? Learn or teach someone Javascript!
Notable projects
- chrome experiments : cool stuff that the chrome browser can do
- js experiments : more cool stuff by Hakim El Hattab
- createjs : collection of libraries for making rich interactive content, games, art, ads, etc.
- threejs : library for creating 3D content for the web
- nodejs : Javascript runtime used for developing applications that are not run in any kind of web browser
- socket.io : real time engine for building multiuser network applications
- electron : framework for developing cross-platform desktop applications
- aframe : framework for developing web virtual reality experiences
- ionic : framework for developing cross-platform mobile applications
- espruino : Javascript powered microcontroller
- kinoma create : Javascript Internet of Things construction kit