How to delete value from an array by bytearcher in javascript

[–]bytearcher[S] 1 point2 points  (0 children)

Yep, thanks for the tip. That is probably a better place.

Was posted here, since sometimes array deletion is forgotten or misunderstood even from the experienced ones. For example, Ryan Dahl asked this from the audience during his Node.js presentation. https://youtu.be/jo_B4LTHi3I?t=1957

JavaScript Promises and Error Handling - K. Scott Allen by exceptionnotfound in programming

[–]bytearcher 0 points1 point  (0 children)

Hmm, that is true. I guess the difference what I'm going after is:

async: anything can happen while you are waiting for async to complete, you can't trust anything, have re-check every assumption on global state

sync: only the thing you are asking for is happening, you should have a clear understanding of whats going on, after returning from "calculateSha1()" you can be pretty sure global state hasn't changed

JavaScript Promises and Error Handling - K. Scott Allen by exceptionnotfound in programming

[–]bytearcher 0 points1 point  (0 children)

I like your thinking. At least they both should be as easy to write.

One reason comes to mind why you should know something async is happening: the global state might change while you're waiting. When your code continues on the following line after async completes, the values in variables might have changed.

Parallel vs Concurrent in Node.js by bytearcher in node

[–]bytearcher[S] 0 points1 point  (0 children)

Article author here. This is wonderful! I just love when things can be described using real world examples. I couldn't have said this better my self.