Snippet: res.send(“Happy Valentine’s Day!”)
Original article published on Medium.com on February 22, 2019
I semi-recently wrote up an article about how I developed my partner’s Valentines Day npm package. Here’s a snippet in case you’d like to sample before you buy (even though it’s free):
The time came for me to actually put fingers on the keyboard and spit out some code. Gaining momentum was tough, and I initially had to refer to my notes for each line, but after an hour or so I noticed something weird: I was kind of having fun, and after building out the basic display logic I had a new idea to expand the app. I had two arrays of length n, and to pick different values on each page refresh, I generated a single random number between 0 and n-1. This matched the same comment with the same picture every time, which got old pretty quickly. If I simply generated two random numbers, I would have n*n pairs instead. Much more interesting!