Post

✨ Big O ✨ Let me take you on a visual introduction to what big O notation is in my new blog post: samwho.dev/big-o. With big O notation you can better understand how algorithms will perform in practice, finding orders of magnitude improvements often with very simple changes to your code.

Loving the interactive demos! In the `buildList` example, there’s no need to stop using `for-of` just to get access to the index. Try: for (const [index, item] of items.entries()) { output.push(`Item ${index + 1}: ${items[index]}`); } Smaller diff, might be easier to follow. WDYT?

I avoided this because it’s a JS-ism some folks might not be familiar with. I felt the index example was a bit more widely accessible ans achieved the same goal. I call out Object.entries under the last code example. 🙏

Oh yeah, good point. I meant Array.prototype.entries in the post, I should fix that.

0 reposts1 like