3 ms·
Brevity is cool, but that's kind of like naming all your variables one letter chars for brevity. This is something every web dev will instantly know what it do
by moffkalast 5y ago
Brevity is cool, but that's kind of like naming all your variables one letter chars for brevity.
This is something every web dev will instantly know what it does:
document.querySelectorAll('#rabbit .green').forEach(tag => {
})
Whereas this is something nobody knows what the fuck it is because it's completely non-standard.
for (const rabbit of dqsA('#rabbits .green')) {
}
And get what, 10 characters less in one row? Basically nothing.
- hombre_fatal 5y agofor/of vs .forEach isn't the issue here. Frankly I almost always use for/of because it's implemented for all iterators and I prefer being outside of a function (e.g. I can use await). All they did was alias `dqsA`. If anything, it's the fn name that could be better.
- d1sxeyes 5y agoIt’s no more ‘non-standard’ than jQuery’s `$`. Most IDEs will allow you to see what dqsA aliases by mousing over. I don’t really see a problem with it. It also looks like the kind of thing a pre-commit hook could trivially expand if you’re working with other people who might find it in some way unacceptable.