From currying to closures there are quite a number of special words used in JavaScript. These will not only help you increase your vocabulary but also better understand JavaScript. Special terms are normally found in documentation and technical articles. But some of them like closures are pretty standard things to know about. Knowing what the word itself means can help you know the concept it's named for better.
package goddrinksjava; | |
/** | |
* The program GodDrinksJava implements an application that | |
* creates an empty simulated world with no meaning or purpose. | |
* | |
* @author momocashew | |
* @lyrics hibiyasleep | |
*/ | |
<html> | |
<!-- You may need to download them from https://github.com/brix/crypto-js/tree/release-3.1.2/build --> | |
<script src="rollups/sha1.js"></script> | |
<script src='components/lib-typedarrays-min.js'></script> | |
<body> | |
<script> | |
function sha1sum() { | |
var oFile = document.getElementById('uploadFile').files[0]; | |
var sha1 = CryptoJS.algo.SHA1.create(); | |
var read = 0; |
https://gist.github.com/ljharb/58faf1cfcb4e6808f74aae4ef7944cff
While attempting to explain JavaScript's reduce
method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.
JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List
is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it mu
There is no documentation at the moment, but there are some rumors. And experimental way I've made sure about few end-points are working good:
GET: https://www.etherchain.org/api/account/0xAAAsomeADDR00000000000/
Will return something like that:
{
TLDR: Use for...of
instead of forEach
in asynchronous code.
Array.prototype.forEach
is not designed for asynchronous code. (It was not suitable for promises, and it is not suitable for async-await.)
For example, the following forEach loop might not do what it appears to do: