JavaScript根据固定字符串重组数组RegExppush

Posted web半晨

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JavaScript根据固定字符串重组数组RegExppush相关的知识,希望对你有一定的参考价值。

function recombination(params) 
    let newArray = [],
        i = 0;
    for (; i < params.length; i++) if (/(a7)/.test(params[i])) newArray.push(params[i]);
    return newArray;


console.log(recombination(['7a7', '66agg', '3jk', '6a79', 'aa6', '886']));
// ['7a7', '6a79']

以上是关于JavaScript根据固定字符串重组数组RegExppush的主要内容,如果未能解决你的问题,请参考以下文章