• Coding Beauty
  • Posts
  • Why ['1', '5', '11'].map(parseInt) returns [1, NaN, 3] in JavaScript

Why ['1', '5', '11'].map(parseInt) returns [1, NaN, 3] in JavaScript

Regex challenge, parseInt mysteries, and more

The Rising Demand for Whiskey: A Smart Investor’s Choice

Why are 250,000 Vinovest customers investing in whiskey?

In a word - consumption.

Global alcohol consumption is on the rise, with projections hitting new peaks by 2028. Whiskey, in particular, is experiencing significant growth, with the number of US craft distilleries quadrupling in the past decade. Younger generations are moving from beer to cocktails, boosting whiskey's popularity.

That’s not all.

Whiskey's tangible nature, market resilience, and Vinovest’s strategic approach make whiskey a smart addition to any diversified portfolio.

Time to see how well you know your regex!

Can you complete the code to insert spaces in the camel-cased words?

What he saw next shook him to his core:

How on earth was this possible? Was parseInt broken? Was there a bug in map()?

He looked up frantically, eliciting a sharp, unnerving laughter from Jake.

Alex, the self-proclaimed coding whiz, prided himself on quick hacks and short code.

Despite being very new to the industry, he always saw himself as superior to the rest of the team, stubbornly doing whatever he felt like; all their well-meant advice falling on deaf ears.

But Alex was soon to meet his catastrophic downfall. A painful, humbling experience he would never forget.

It all started when Alex and Cody were assigned a project task. To let users view the products for the ongoing eCommerce website the team had been working on.

They were still in startup phase so all the data was stored and updated in a CSV file.

The product name, price, quantity... all the usual stuff you'd see on sites like Amazon.

Alex arrogantly scoffed when he learned of the planned collaboration.

“I don’t need to work with ANYONE okay?” He smirked at Jake, the good-natured head of engineering, as he typed on his PC. “It’s literally just to fetch from the DB and show in the JSX”.

Gmail has 2 billion users.

And if you’re one of them, there’s no doubt you’ve seen this beautiful text field:

It’s fluid, it’s intuitive, it’s colorful 🎨.

It’s Material Design: the wildly popular UI design system powering YouTube, WhatsApp, and many other heavily used apps.

Let’s begin a journey of recreating it from scratch with pure vanilla HTML, CSS, and JavaScript.

1. Start: Create basic input and label

As always we start with the critical HTML foundation, the skeleton:

The text input, a label, and a wrapper for both:

Thanks for taking the time to read today’s issue.

Don’t let the bugs byte,
Tari Ibaba