DEV Community

Do you hate JavaScript?

David Neal on February 15, 2017

If you follow me on Twitter you know that I poke fun at JavaScript quite a bit. Someone recently asked me, "Do you hate JavaScript?" No! I genu...
Collapse
 
dubyabrian profile image
W. Brian Gourlie

Know nothing about programming? JavaScript is a great place to start!

Is it, though?

Besides being a mess of a language that constantly violates the principle of least astonishment, it's also a mess of tools with so many choices that it would completely overwhelm anyone who just wants to learn programming.

IMO, a language that qualifies as a "good place to learn programming" would include as part of its standard distribution:

  • A standard library
  • A package manager
  • A build system (if applicable)
  • Documentation that accurately reflects the features and capabilities of the distributed language

It would also have a standard module system, and wouldn't require transforms to use official language features, problems that are "uniquely javascript."

Collapse
 
reverentgeek profile image
David Neal

I can't argue those are real challenges in the JavaScript ecosystem. I submit Node.js provides an environment with most, if not all, of those important features.

Regardless, I believe the language, itself, is easy to learn. You don't need a compiler or special tools. You can use your own browser, or one of the many online editors, such as JSFiddle.

My 11-year-old son is learning JavaScript/Node.js and PHP. He's having a blast learning core programming concepts, while blissfully unaware of all the complexities that exist.

Yes, I believe JavaScript is a good place to start. And, there are many other languages that are a good place to start, too :)

Collapse
 
dubyabrian profile image
W. Brian Gourlie

If using javascript in a specific environment and in a procedural manner, then yes, it's as good a place as any to start. But you will hit a ceiling, and once you have a desire to do more, you'll inevitably run into issues that overwhelm even experienced developers.

Also, the intent isn't to evangelize any particular language. I would easily recommend languages that I'm not fond of to beginner programmers—PHP, Python, or Ruby—over javascript. The concepts learned from these languages will apply more generally to others, while also being generally more sane.

With all that being said, the world still needs javascript developers, so learning it is not without merit. It's more a question of whether or not it's a good introduction to programming, which is where I suppose we disagree.

Thread Thread
 
nicolasnarvaez profile image
Nicolás Narváez

The point was to "introduce programing", not the dificulties of becoming an expert on it: "but you will hit a ceiling".

JS is so easy to use for a beginner, that you can invoke a repl with a hotkey 80% of the time, and test core programing concepts with lots of variations.

Thread Thread
 
hishamfangs profile image
Hisham El-Fangary • Edited

I absolutely hate PHP's syntax and standards, and for a beginner it doesn't just look daunting with all the $ signs, but visually it looks quite ugly.

"But you will hit a ceiling, and once you have a desire to do more, you'll inevitably run into issues that overwhelm even experienced developers."

Used to be true, but it isn't anymore with ES6. I am yet to run into any ceilings or issues and I've been using it to develop extremely complex systems with large code bases.

Bar none, it is my number 1 choice for introduction to programming. Nothing comes close in terms of user-friendliness and ease of use.
Opening a browser console and typing "x=2+3" and getting an immediate response with any complications allows for an easy introduction to programming concepts without showing the student a bunch of class declarations and voids everywhere and asking them to ignore it for now.

Thread Thread
 
dubyabrian profile image
W. Brian Gourlie

If you could teach someone programming entirely in a browser console window, you may have a point. But you can't. Eventually, you will end up having to explain the many intuitive javascript quirks that have built up over the years. Including with ES6.

New developers will marvel at the simplicity and ease-of-use of javascript while they struggle to understand why this doesn't refer to the thing they expect it to, depending on the syntax they use to declare a function.

Thread Thread
 
mateiadrielrafael profile image
Matei Adriel

I dont think your "this" example is viable since every language has its parts which seem normal to everyone except begginers (like how a lot of starters i know asked me why 9 / 2 equals 4 when they try to do some random stuff in python).

Also, i think most people start wondering about what "this" means after they learned the basics (at least i did, idk about others)

I think almost any popular language is okay for starters, and just saying one of them isnt because of some quirks doesnt make that much sense since u can sya that about any other:)

Collapse
 
andrespineros profile image
Andrés Felipe Piñeros

Your son isn't a valid argument. He's doing fine because he has a Javascript programmer showing him the way. Most people, even adults, don't have that.

I feel like Javascript is too quirky to be a learning language, but I do consoder Async a very important concept that other languages such as Java and Python don't have at their core.

So yeha, Javascript is great if you have someone that already understands those quirks to guide you.

Thread Thread
 
mateiadrielrafael profile image
Matei Adriel

Im just some random 16 yr old guy from the internet, and ive started like 2 and something years ago. Js was a very easy to learn lang (without someone teaching me / paid courses) , just by googling "how to do x in js", i know this doesnt happen for everyone, just sharing my learning story thing:)

Collapse
 
bgadrian profile image
Adrian B.G. • Edited

If anyone is in doubt of the JS supremacy I wrote a comprehensive list of things you can build with JavaScript, from websites to controlling robots.

I agree JS is great for learning Programming (after Scratch), but only if

  • the person just want to learn the basics
  • gets bored fast (kids), after they learn Scratch
  • it is a non technical person with no similar background
  • just want to make a personal side weekend project

PS: JavaScript doesn't mean the entire Web ecosystem (node etc), just things like codecombat.com codewars or drawing in khanacademy or to tweak your blog plugins.

If you want to work in Computer Science for at least 5-10 yrs it would be better to start with a strong type language, go trough the proper learning steps.

Depending on the day I hate JavaScript too, but tomorrow I will sure 💚 it back again.

Collapse
 
reverentgeek profile image
David Neal

That is an awesome list!

Collapse
 
hkrogstie profile image
Håvard Krogstie

My problem with javascript is that Python is better for all use I've ever seen, save for websites where you don't have a choice. Now I don't usually use either, so do tell if you know of a killer feature only in javascript.

Collapse
 
olekria profile image
Olek Ria

How you write Single Page Applications in Python ?

Collapse
 
hkrogstie profile image
Håvard Krogstie

Well single page applications in the browser are websites, where you for the time being don't have a choice. However if I want a web service, I'd much rather use django's templating engine and not worry about single page.

Thread Thread
 
olekria profile image
Olek Ria

A lot of option in java and c# also. Please do not concentrate at Python.

Thread Thread
 
hkrogstie profile image
Håvard Krogstie

Yes, there are definitely websites I've done in python I wish I'd done in e.g. Java, but the purpose of this post was problems with JavaScript. Java and C# don't have dynamic typing, for instance, meaning JavaScript has something they don't. Personally I prefer static typing, but among the languages that don't have it, I prefer python.

Thread Thread
 
olekria profile image
Olek Ria

C# HAS dynamic typing.

Thread Thread
 
hkrogstie profile image
Håvard Krogstie • Edited

Ok sorry, I didn't know. I wouldn't want to use it even if it does. You can pass Objects around in java as well, I suppose. C# and Java sort of have functions as first class citizens as well, now. Java streams can almost do all the python list magic as well. Basically, I conclude with preferring Java, C#, and Python, since they all do what JavaScript do, just without undefined

Thread Thread
 
mateiadrielrafael profile image
Matei Adriel

For me personally: typescript > python > javascript

Collapse
 
courier10pt profile image
Bob van Hoove • Edited

Thanks for writing. It's good to have an up to date list of go-to resources.
The title is a bit misleading but it worked cause I clicked on it :)

TL;DR I love javascript

.. going back to 2009 ish ..

For me javascript was the language that allowed me to find pleasure in
programming. When I first started working I was maintaining ASP Classic pages,
mostly written in VB script. As I had 'some college' in CS and AI, I found VB
script was holding me back, lacking abstraction features.

Back then Douglas Crockford and YUI started making their lectures available.
Curious to learn a little more about Javascript I started watching the
Crockford lectures. That was amazing, almost like free college on demand
:)

I learned that the language had functions as values, a prototype system and
lazy evaluation. It made up for everything VB script lacked. I
started tinkering with the language a lot. I even made a web crawler in
JScript for fun.

Becoming proficient in javascript allowed me to pick up more interesting tasks
at work as well as help others with javascript (or jQuery) problems. So that
was some time well invested. Also finding myself building stuff just for fun
made me aware that I found the right profession.

That's why I love javascript.

Collapse
 
reverentgeek profile image
David Neal

My love/hate relationship with JavaScript (and JScript!) began when I was building classic ASP apps in the late 90’s and early 2000’s. Thanks for sharing your story :)

Collapse
 
rmorschel profile image
Robert Morschel

I wish I'd seen this article last month, when I decided I was going to finally get good at Javascript. Nice.

I would say, however, that Javascript is a terrible for learning how to code, unless you use it in a prescriptive framework. It is too permissive for the novice.

Collapse
 
antonfrattaroli profile image
Anton Frattaroli

The permissivity is a tradeoff for novices. It gives them fewer but less useful errors. Beginners don't read error messages, so fewer errors may be better than useful error messages.

Collapse
 
ryanwinchester profile image
Ryan Winchester

Javascript makes baby Jesus cry. I can't stand it. Everything about it.

Collapse
 
nancyd profile image
Nancy Deschenes • Edited

What's great about JavaScript, is that it's so easy to get started with it. If you're reading this message, you already have access to enough tools to get started- nothing to install, nothing to read first, just try something, and see what happens. There are so many examples of code that does what you're likely to think of (if you're new to the language and/or programming). The cycle of "I wonder what would happen if..." to "ah! that's what it does" is so short, it's energizing and thrilling. Anyone can do it!

What's horrible about Javascript, is that it's so easy to get started with it. If you're reading this message, you already have access to.... Anyone can do it!

Joking aside, the original JavaScript was pretty shady. It got things done, but without much concern for maintainability or complexity. It has evolved into a very interesting language, and you can code very elegantly using it. Unfortunately since it still supports the original "let's throw something together" of its early days, it cannot enforce clean programming techniques, and the beauty and quality of JavaScript programs has very little to do with the language, and almost all to do with the programmer.

Collapse
 
gkatsanos profile image
George Katsanos • Edited

I am a frontend developer who, university aside, got into programming with JavaScript and if I had to do it all over again I'd start with a language like ruby or Swift. The flexibility of JavaScript leads to learning the wrong way, making assumptions which lead to bad practices. You won't imagine the crimes I've seen by junior Front-end devs who do JavaScript..

Collapse
 
heroofcanton profile image
Ryan Welling

Javascript makes me sad inside. Yes, it's better with ES6, but it's still an unintelligible mess most of the time. By all means though, keep putting framework lipstick on that pig.

Collapse
 
yogistraanderson profile image
Yogistra Anderson

In my experience is excellent for use in a particular context: the web client.

I dont see languages as better or worse, it depends on the application of that language. Its a tool, you have to select the right tool for each particular job.

If anyone would look at Perl code, they would recoil in horror. Its terrible to decipher, but for processing text, its probably the topmost option in the languages toolbox.

While it is possible with very disciplined design, to build large modular applications, thats not really Javascript's niche.

However for manipulating the HTML DOM (made super powerful with JQuery selectors) its unparalleled.

It has really improved over the years (I started around 2003 using Javascript) with nice syntax for classes and some really useful stuff for doing asynchronous programming.

A book to have a thorough understanding of Javascript would be David Flanigan Javascript Guide.

That book has grown into a monster as Javascript has evolved. My initial edition of that book was half the size of the current print.

Collapse
 
golopot profile image
Chiawen Chen

Old javascript I hate:
Jquery DOM manipulation, callback hell, module pattern, function(){...}

New javascript I love:
React, Promise, ES6 module, arrow function

Collapse
 
eazel7 profile image
Diego

Cloud9 is also very very good as a JS IDE
I run an instance of it in a server so I have my environment ready to use and share with anyone

Collapse
 
auct profile image
auct

javascript makes me upset every time I need to do smth in it.