【发布时间】:2019-05-02 21:17:53
【问题描述】:
我正在使用 angular 来过滤自动完成字段的大量字符串。 最有效的方法是什么?
largeArrayOfStrings = ['string1', 'string2', 'test one', 'one', 'two test', 'three', 'test one two', ...]
substring = [‘test’, ‘one’, ‘two’]
values = substringArray.map(h.includes)
// I would want values to be the following
values = ['test one two']
// That is the only string that contains all the strings from substring array.
【问题讨论】:
标签: javascript arrays string dictionary filter