Made to Imitate?

Hey there!
I'm an electronics engineer who's dabbled in a bit of everything, including full-stack development and web3 technologies. I love building cool stuff and am always looking to connect with other like-minded professionals. When I'm not tinkering with new projects, you can find me scouring the internet for the latest and greatest in tech.
for (i = 0; i < numberOfElements; i++) {
doSomethingWith(element[i]);
}
This works, but isn't very elegant. The Ruby way is much more elegant.
elements.each do |element|
do_something_with(element)
end
But what about JavaScript's forEach?
elements.forEach((element) => {
doSomethingWith(element);
});
JavaScript's forEach gets close to Ruby's elegance, but it comes with some notable quirks. You can't break out of it (if you need to exit early, you're stuck reaching for a for...of loop or throwing an exception). It doesn't work well with async/await either, since it fires off all callbacks without waiting for them to resolve. And it always returns undefined, so unlike Ruby's chainable enumerables, you can't build fluent pipelines with it.
Modern JavaScript's for...of actually gets closer to the Ruby spirit:
for (const element of elements) {
doSomethingWith(element);
}
This supports break, continue, works with await, and handles any iterable, not just arrays. Still, Ruby's enumerable ecosystem (map, select, reject, each_with_object) feels more cohesive because it was a core design philosophy from day one, not an afterthought bolted onto a prototype chain.
It's day one of learning Ruby, and I think I'm falling in love with the language.
I might be a little biased - last night I fell asleep watching the Ruby on Rails documentary. I woke up with this strong desire to learn Ruby and try it out. I think when you hear people who genuinely love something, you can't help but want to experience it yourself.
And it's not just programming languages. DHH's rant about getting married and having kids on the Top Shelf podcast with ThePrimeagen and TJ DeVries (looking back, it played it's part, however small, in me getting married). Or Prime's rants about being competent and taking ownership of your craft.
It's more fun and lively when you have role models, people who have lived the life you want to live, people worth imitating.





