developit / developit/jasonformat.com

I have no Twitter but I'd like to comment:

未关闭
#5 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
JavaScript
星标
20
派生
6
PR 合并指标
30 天内没有已合并 PR

描述

Hi Jason,

Apologies for (mis)using github issues as a place for comments (see subject line)

I just read your blogpost: [Quick tip: reusable Array search predicates](https://jasonformat.com/reusable-array-search-predicates). In the past I've achieved a similar effect (in terms of developer experience) by having a function that returns a function eg.
```
const byId = (value) => {
return (element) => {
element.id == value;
}
}

myArray.filter( byId(12) );
```
Of course each time I'm creating a new function for the predicate so I'm not really reusing it but it feels that way (as I say, dev experience...). I wonder if you have any insight into how the two approaches might differ, performance or other-wise.

Thanks for writing your blog, it's always interesting.

Tom

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。