DEV Community

Donte Ladatto
Donte Ladatto

Posted on • Edited on

The Ladatto Code

I've always taken great pride in building things. From Lincoln Logs and Tinkertoys to K'nex and Legos, to then countless hours of Minecraft, my life thus far has been full of creative construction. There is no greater feeling to me than to look upon a finished project and think with satisfaction, I made that.

Throughout high school and heading into my first two years of college, I thought I wanted to become an architect. After an introspective year off, I realized that while designing structures definitely interested me, it was really only half of the thrill. I wanted to build as well, to see my designs come to fruition through the use of my own two hands. I needed to find a new calling, but in the meantime I took a job dealing table games at a casino. The meantime turned out to be a long time, and seven years had passed before I decided to delve into coding alongside some close friends of mine.

With code, I believe I have finally found what I've been looking for. I have the means to create anything within the scope of my imagination, using components spun from my fingertips. Learning new syntaxes is simultaneously daunting and exhilarating, but after each foray into new material I emerge with another tool to add to my repertoire. It's an incredibly rewarding and fulfilling experience, and I'm only just scratching the surface.

Now, let's have some fun with my above ramblings:

const ramble = `I've always taken great pride in building things. From Lincoln Logs and Tinkertoys to K'nex and Legos, to then countless hours of Minecraft, my life thus far has been full of creative construction. There is no greater feeling to me than to look upon a finished project and think with satisfaction, I made that. Throughout high school and heading into my first two years of college, I thought I wanted to become an architect. After an introspective year off, I realized that while designing structures definitely interested me, it was really only half of the thrill. I wanted to build as well, to see my designs come to fruition through the use of my own two hands. I needed to find a new calling, but in the meantime I took a job dealing table games at a casino. The meantime turned out to be a long time, and seven years had passed before I decided to delve into coding alongside some close friends of mine. With code, I believe I have finally found what I've been looking for. I have the means to create anything within the scope of my imagination, using components spun from my fingertips. Learning new syntaxes is simultaneously daunting and exhilarating, but after each foray into new material I emerge with another tool to add to my repertoire. It's an incredibly rewarding and fulfilling experience, and I'm only just scratching the surface.`
Enter fullscreen mode Exit fullscreen mode

How many times did I say 'I'?

const rambleArr = ramble.split(" ")

rambleArr.filter(word => word === "I").length
//12
Enter fullscreen mode Exit fullscreen mode

Huh. That's fewer than I thought. And?

rambleArr.filter(word => word === "and").length
//8
Enter fullscreen mode Exit fullscreen mode

Longest word?

rambleArr.reduce((a, b) => a.length < b.length ? b : a, "")
//'simultaneously'
Enter fullscreen mode Exit fullscreen mode

Fun! But wait; I've now noticed that rambleArr contains words with punctuation attached to them. This really could have interfered with the methods I've been using. One quick Google search later and I've been introduced to the wonderful world of regex operators!

const wordBoundaryArr = ramble.split(/\b/)
Enter fullscreen mode Exit fullscreen mode

I've blown up my contractions, now how many times did I actually refer to myself...

wordBoundaryArr.filter(word => word === "I").length
//15
Enter fullscreen mode Exit fullscreen mode

Very cool, and an excellent example of why I love coding. I learned something new just by goofing around! Yes, I have indeed found what I've been searching for.

Top comments (0)