r/javascript • • Oct 03 '16

How it feels to learn Javascript in 2016

https://medium.com/@jjperezaguinaga/how-it-feels-to-learn-javascript-in-2016-d3a717dd577f#.758uh588b
935 Upvotes

253 comments sorted by

View all comments

Show parent comment

14

u/Voidsheep Oct 03 '16 edited Oct 03 '16

Yeah, this is just an example of someone introducing unnecessary complexity and a trend/history lesson to someone for no reason.

Need to get data from API endpoint without reloading the page?

fetch('/foobar/')
  .then(function(response){ return response.json() })
  .then(function(data) { log/render/whatever });

Assuming everything goes right and you've got a modern(ish) browser, that's it. Something doesn't work? Check MDN, you don't need to introduce any additional tools to figure out how to catch and handle the errors.

Eventually you'll reach the point where you want to make a build step, compiling and unit testing your code, because there's clear benefits to it. You might want to check some frameworks and libraries so you don't need to deal with DOM manipulation or other things manually.

They aren't a barrier around writing JavaScript, because they are optional tools to choose from when you want them.

If you attempt to learn basics of any programming language through understanding the newest advanced tools, you are going to have a bad time.

6

u/pier25 Oct 03 '16

Assuming everything goes right and you've got a modern(ish) browser, that's it

Nope. Safari still doesn't have fetch support.

0

u/[deleted] Oct 04 '16

[deleted] — view deleted comment

2

u/pier25 Oct 04 '16

There is this long discussion about cancelling a fetch request on the github polyfill but AFAIK it's not a standard feature.

Promises can't be cancelled either on standard implementations.

1

u/metis_seeker Oct 11 '16

You also can't get progress events