<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        var sel = ''
        var arr = ['白色', '小白', '红色', '紫色', '黑色']
        for (let index = 0; index < arr.length; index++) {
            var txt = new RegExp(sel);
            if(txt.test(arr[index])) {
                console.log(arr[index])
            } else {
                console.log('不包含')
            }
        }
    </script>
</body>
</html>

 

相关文章:

  • 2021-12-05
  • 2022-12-23
  • 2021-09-01
  • 2021-06-21
  • 2022-12-23
  • 2021-09-02
  • 2022-02-09
猜你喜欢
  • 2021-09-20
  • 2022-12-23
  • 2021-12-14
  • 2022-12-23
  • 2021-06-10
  • 2021-07-25
相关资源
相似解决方案