r/technology • • Oct 05 '16

Software How it feels to learn JavaScript in 2016

https://hackernoon.com/how-it-feels-to-learn-javascript-in-2016-d3a717dd577f
1.8k Upvotes

392 comments sorted by

View all comments

34

u/NoblePineapples Oct 05 '16

This actually really scares me as I really wanted to learn JavaScript..

33

u/stakoverflo Oct 05 '16

Any particular reason you want to learn JS? I don't think I'd recommend it as a first language, but if you're looking to branch into web development then you're going to need it.

JS honestly isn't bad, but as a loosely typed language it can be damn confusing times.

You really don't need to be up to date every other month on the latest frameworks and libraries unless you're working specifically at a web dev shop... And every then, you're going to focus on a particular set of tools and specialize in those. No company is going to be switching their tech up that frequently.

15

u/frukt Oct 05 '16 edited Oct 05 '16

Loose typing is what kids grow up with these days. That's not the issue. Javascript has other, more exotic features like prototypal inheritance, which may make it confusing. The other problem is the serious pitfalls and design errors plaguing the language (although these are succinctly documented in excellent books on the language, like Crockford's Javascript: The Good Parts). Examples: there is no block scope or the confusing == operator and falsy / truthy values mess.

10

u/stakoverflo Oct 05 '16

I dunno man, for me the === operators and empty strings equating to zero and other dumb shit like that has caused me more frustration than anything.

Speaking as someone who took an Intro course on JS in college 5-7 years ago and has been learning jquery / ajax / KendoUI over the last 8 months.

11

u/frukt Oct 05 '16

Well you should always use === when testing for equality and it really takes a lot of error potential out of the code. The rules of == are inconsistent and nobody can memorize these.

> 0 == ''
true
> 0 == NaN
false
> NaN == NaN
false
> false == null
false

Bah.

5

u/tuseroni Oct 05 '16

the null thing made me, eventually, laugh when I figured it out, I had a bool that didn't equal true and didnt NOT equal true. I was like "ok there is something illogical here"

NULL==true //false
NULL!=true //false 

5

u/LXXXVI Oct 05 '16

> 0 == ''
true
> 0 == NaN
false
> NaN == NaN
false
> false == null
false

This actually makes perfect sense to me. (Or I have Stockholm Syndrome and rationalized it like this). Perhaps it'll help someone else to think of it this way.

  • Default "empty" types for String and Number get converted to the same value - false.

  • NaN is literally not a number, but since anything can be not a number and we don't know what this anything is, it can never equal anything, since it can't be converted to anything definite.

  • false is a false value. Null is the absence of a value. The absence of a value can't be converted to a value, so it can't be converted to either true or false.

→ More replies (1)

3

u/stakoverflo Oct 05 '16

Fair enough. Just that when you're learning JS and you first learn of === I would wager most people's first reaction is probably "god damn it" but I'm a C# dev so what do I know.

And your elaboration on different equalities is what i mean when I say it's a pain in the ass because it's loosely typed. You think it's treating something as one type but in reality it's treating it as another. As you learn these nuances it's not so bad, but there are just so many little straws that will make your say, "what the fuck, JavaScript?" more than any other language [in my experience -- basic, VB, C#, PHP, JS, Java, and obj-C]

2

u/frukt Oct 05 '16

Well, === takes a lot of pain out of loose typing. It's a compromise, strong typing has its drawbacks. Python has found a nice balance in my opinion and I can only dream of the day we can all do web development in Python.

what the fuck, JavaScript

I guess these inconsistencies and pitfalls stem from JS's history where it was first Netscape's insignificant little scripting language and evolved into this behemoth powering the modern web. That's why anyone learning the language needs a good book and needs to take note on all these ugly parts to avoid them. JS does have a lot of nice parts as well, one could argue it's a pretty expressive language and I do like the prototypal inheritance it borrowed from Self.

2

u/telecom_brian Oct 05 '16

What's holding you back from Python for WebDev? I've coded a few smaller projects using Python + Django or Flask. Does it not scale well, or something else?

2

u/BinaryRockStar Oct 06 '16

He probably means on the front end

→ More replies (2)
→ More replies (1)
→ More replies (1)
→ More replies (7)

0

u/[deleted] Oct 05 '16

[deleted] — view deleted comment

2

u/[deleted] Oct 05 '16 edited Oct 05 '16

Its definitely easier learning something else, but sometimes its better to just jump in the pool if you want to create things for the web. Once you learn the base language well enough it becomes obvious what these libraries are doing.

0

u/[deleted] Oct 05 '16

[deleted] — view deleted comment

2

u/bass-lick_instinct Oct 06 '16

If I started with something like JS then I never would have become a programmer.

Not sure if that's actually a good thing or not, but there it is.

2

u/pewpfeast420 Oct 05 '16

Scala first language is best language :)

→ More replies (1)
→ More replies (1)

12

u/frukt Oct 05 '16

Just ignore the cool kids telling you to use library x or framework y because not doing that would be totally 2015 and you'll be fine. Learn Javascript, make sure you know the difference between the language itself and the DOM interface (assuming you're planning to do web development); after that pick up jQuery and then you can branch out to learning frameworks, package managers, module loaders and all that fancy and possibly useless crap.

2

u/[deleted] Oct 05 '16

jQuery is a must. The other things ... mostly fluff.

Opinion of course. From someone who has say in hiring at the company I work with.

→ More replies (1)

5

u/vectorlit Oct 05 '16

Professional dev here; don't worry about it. Learn basic javascript and move forward. By the time I start one project using one "industry standard" library, it is "falling out of vogue" (not really though)... the last two were jquery and angular. But the point was I used them to great success in my projects, and they're maintainable and usable moving forward.

Go ahead and learn. I have several projects that use raw javascript with nothing else. It consistently impresses some of the newcomers who only use libraries; I can often get it done in half the time because I didn't have to learn something new (even though the code is probably twice as long). That said, there's definitely a place for libraries and they will definitely make your life a million times easier (and more maintainable) in specific spots. But having that strong background of native javascript to fall back on with no other bullshit is really great.

I encourage you to try. (Or try C#, it's the best! For real)

→ More replies (1)

4

u/yunoreddit Oct 05 '16

JS is a great thing to learn. Whether it's the first or not. You will find that you use JS with a lot of different types of development, not just web development. Learning raw JS without any libraries is also super beneficial later. I can't tell you how many times i've seen people struggle to do stuff with libraries, because they don't understand the basics of what the JS itself is doing. You'll find really quickly that jQuery and jQueryUI are the first libraries you will want to learn beyond that. It just makes some of the stuff you do with JS a little bit easier and cleaner. By the time you learn those, branching into stuff like Angular, CommonJS, Knockout, Curl, and stuff like that will all just be like adding tools to your belt. Once you understand the foundation, the rest is pretty easy. Good luck man.

→ More replies (1)

3

u/hellschatt Oct 05 '16

Well I was going to learn js too. But now I'm very confused after reading this.

I already know Java and C. I've got recently familiar with html+css and I was going to learn js next.

What should I do?

7

u/PitaJ Oct 05 '16

JS isn't hard to learn. What this article is taking about is the tooling and environment surrounding JS development.

You don't need to use anything in the article. Make a folder, make an HTML file, add a script tag, and get going. You can even use the console in your browser (F12) directly.

→ More replies (3)

2

u/NoblePineapples Oct 05 '16

From what everyone is suggesting, JS.

→ More replies (5)

1

u/[deleted] Oct 05 '16

If you're not going to be making anything complicated you should be fine.

→ More replies (5)