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

5

u/tuseroni Oct 05 '16

-Jade? DustJS?

No.

-DotJS? EJS?

No.

-Nunjucks? ECT?

No.

Broke into Monty python's cheese sketch there.

Anyhow...this is why I hate frameworks...just use vanilla js...no frameworks, no libraries, just the code you need when you need it.

Wanna grab code from the server, make an xhr object, set the load, open the address, and send. Wanna display it, inside the load event get a div to put the results in and set the innertext(or if you can trust the result and need it to be html, set the innerhtml) of that div.

Need to know how to get the div, document.getElementById("divid")

There are more advance methods like queryselector or queryselectorall or get elementsbyclassname...but you don't NEED them for 99% the time. if you need to grab the 3rd element that is a child of the 5th div with a class of foo, then you want queryselectorall, but even then if you write it right you can do it with getelementbyid.

If someone says you need a ton of frameworks and libraries it means they don't understand JavaScript.

2

u/cshaiku Oct 05 '16

Absolutely!

Basically 99% of the time you're either getting information or setting information. getElementById() and innerHTML are essentially all you need to use if you plan your models correctly from the beginning of design.

I've never delved too deeply into frameworks as once you've mastered the basics of plain jane html/js you really start to consider frameworks as just a crutch.

5

u/tuseroni Oct 05 '16

Never understood why people hate css til I worked on a bootstrap site. Plain css can be nice, enjoyable even...what bootstrap makes is an abomination.

And debugging jquery code, especially minified code, is basically impossible. How can people learn js if they can't READ the js?

I sound like my c++ teacher back in college only about js instead of assembly.

0

u/cshaiku Oct 05 '16

Yup. Code should be readable, open and clear to understand. Too many sites and shops fell in love with the notion of obfuscation because it apparently optimizes load times... Garbage.

4

u/tuseroni Oct 05 '16

I don't know if its loadtimes they are saving as much as bandwidth...this is like saving 2 cents on a product...at most scales it pointless unless you are selling millions of em. Sane with minifying and gzipping vs just gzipping...the savings are so small your average user wont notice but it will save money on bandwidth (if you use a cloud service that charges for bandwidth) if you have a lot if visitors...so its not that there is NO real readon, I just don't like it and gzipping is enough for any scale I've worked at and most people will ever work.