/ typescript

Death of the for loop?

So I was hit with a revelation this morning. I haven't written a for loop in months. Is this the end of it? Has it been replaced with functions like map, filter and find?

Functional programming ideas are definitely leaking into everyday languages. First class functions definitely are a big part of this.

Take a React example. If I have a list of items, I'll typically end up with code such as:-

<ul>
    {names.map((name: string) => <li key={name}>{name}</li>)}
</ul>

The alternative is:-

output('<ul>');
for (let i = 0; i < names.length; i++) {
    output(`<li key="${names[i]}">${names[i]}</li>`);
}
output('</ul>');

I know which I prefer...