Learning better JavaScript By working on side projects

There are TONS of ways to learn JavaScript these days, but what's worked well for me has always been hacking on side projects. React, Yarn, ES6... these are a few of the skills I've picked up while working on my side project Newclick, an e-commerce advertising platform

Today I learned something cool and I thought I'd share it. The findIndex() method in JavaScript! It's the tool I've always needed.... and it finally came into view.

The Problem

For my use case, I needed to search through an array of objects and compare two (similar but not matching) objects:


As you can see one object has an approximate_size key/value, while the other does not. Now imagine trying to match these two using one line of code... I'll spare you a headache, it's hard to do. What saved my ass in this particular case was using findIndex(). 

Before findIndex()

What led me to the findIndex() method was trying (and ultimately failing) to use it's younger brother: indexOf(). 

indexOf() can give you the index of an object in an array, but the objects need to have the EXACT same key/values. If a particular key/value exists in one, but not the other, it won't work. Which makes sense, seeing as they techincally do not match.


After findIndex()

What I was looking for was a way to match the values of the objects that I KNEW existed in both... This line of code will search our custom audience array and match against the ID, a value that we KNOW exists. The benefit here is that we can use findIndex to match similar objects rather than exact.



Oh... "but why?", you ask. So we can filter arrays of course! Oh and also for my react App. I'm building a Market research tool that allows users to create and save Facebook Audience Targeting Ad Settings.  Use the findIndex method to dynamically filter an array of custom audiences, find a match and "check" a checkbox. See a screen shot below!



How hacking my wife's Etsy business led to my first SaaS product

Want to hear my favorite perk of getting married? Beware, it's pretty dorky... You ready? 

Access to my wife's data.

I was in search of my next side project about four months ago. My wife quickly volunteered me to handle her Etsy product advertising on Facebook. She wanted to take her listings on Etsy and quickly create marketing campaigns using product images, titles, and descriptions. After a night of painfully searching for the same images used on Etsy while copying/pasting endless descriptions and titles I started to think to myself, "there's got to be an easier way"My engineering brain kicked into gear.

Read More