while I don't find for of loops less readable than any functional array transformation.
I use functional methods heavily for array transformations or when I use React.
Other than that I find loops more readable when logic is longer than 3, 4 line or contains many if/else.
In async stuff loops are much better because in map/reduce you need to await the map/reduce and make the inner function async and also await inside it.
for ex:
asyncfunctiongetUsers(userIds){constusers=userIds.map(asyncuserId=>{constresponse=awaitfetch(`/api/users/${userId}`);returnresponse.json();});// ... do some stuffreturnusers;}
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
while I don't find
for of
loops less readable than any functional array transformation.I use functional methods heavily for array transformations or when I use React.
Other than that I find loops more readable when logic is longer than 3, 4 line or contains many if/else.
In async stuff loops are much better because in map/reduce you need to await the map/reduce and make the inner function async and also await inside it.
for ex: