Hacker News new | ask | show | jobs
by pestatije 1272 days ago
filteredData, noDateFilteredData, etc. gives me more info than a, b, etc.

Let's say you have 2 lines of code where the variable a is used: a = expr, b = a.filter(...)

Now I have to do the mental effort to see what expr is doing, instead of going directly to the second line and see filteredDateData = filteredData.filter(...)

1 comments

I'd prefer it like this...

// get users older than 90

a = data.results;

b = a.filter(u => u.dob > 123456)

seniorUsers = b.map(x => {name: x.name, age: x.age})

// self contained

// comes out with one final var that is named to be used later on

// other vars are obviously meant to be ignored and just placeholders

// comment explains what is happening so each var doesn't need sacrifice comprehension speed

Gonna need parens around that object constructor. ;)
.... Always