js知道value值的一个数组,根据字典关系数据筛选出对应的text值的数组

0
var values = ['1','2','4'];
var data = [{value:'1',text:'清香1'},
            {value:'2',text:'清香2'},
            {value:'3',text:'清香3'},
            {value:'4',text:'清香4'},
            {value:'5',text:'清香5'},
            {value:'6',text:'清香6'}];
            

我需要得到 与values对应的text值的数组
例如:var texts = ['清香1','清香2','清香4'];

代码希望简洁,高效

请尽量让自己的答案能够对别人有帮助

2个答案

默认排序 按投票排序
0

Great article. I found this much information, like what I'm looking for exactly. Thanks for such posts and please keep it up.

fnaf world​​​       

0

This is a great article. It gave me a lot of useful information. thank you very much. 
Vex 3