DEV Community

Discussion on: Front-end best practices (featuring Vue.js)

Collapse
 
champi profile image
Champi • Edited

Cool!

I too prefer to just access a prop in an object rather than iterating over an array. Big O(1).

It gets worse if you're trying to write a complex algo for parsing data that comes from the server trying to give it some useful shape for the ui. (E.g. data for a table).

Sometimes I do iterate over an array (just one time) to convert it into a dictionary (an object).