by pestatije · 3y ago · 0 comments
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(...)
// 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