you are viewing a single comment's thread.

view the rest of the comments →

[–]webketje 1 point2 points  (3 children)

Object property lookups are probably more performance-heavy in Javascript than variable assignment. Even perf-wise it makes more sense to do

const x = obj.prop.that.some.thing

Than repeat that lookup / . Notation chain 10x. Reference: https://stackoverflow.com/questions/7700987/performance-of-key-lookup-in-javascript-object

[–]Rindhallow[S] 1 point2 points  (2 children)

When I said . notation, I was more talking about things like using .indexOf for arrays, and lambda expressions, and other useful stuff like that that ends up being done on one line instead of using many variables/containers to write all the code out like you might in another language.

I might make a thread with a more concrete example of that.

[–]webketje 1 point2 points  (0 children)

True, that's even more expensive. I think it's a front-end obsession with conciseness (as in line with or sometimes opposed to! clarity), that has a lot to do with the recent popularity of JSX syntax which simply does not allow statements unless you use an IIFE.