fetch('https://api.github.com/') .then(res => { return res.json(); }) .then(function(data) { console.log(data); }) .catch(err => console.log(err));
^ I did not even know that this could be shortened the way you suggested. Thanks for explaining this idea of a stored function definition. I'm not quite sure I've got my head wrapper around the idea, but I believe to have a better understanding now.
Thanks! However, as mentioned by jburgy, we do have to be aware of some weird outliers.
You do have to be careful with things like
['0', '1', '2'].map(parseInt)
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
^ I did not even know that this could be shortened the way you suggested. Thanks for explaining this idea of a stored function definition. I'm not quite sure I've got my head wrapper around the idea, but I believe to have a better understanding now.
Thanks! However, as mentioned by jburgy, we do have to be aware of some weird outliers.
You do have to be careful with things like