JSFiddle - React, Tailwind, and code Playground
JavaScript
var results = ["x", "abc", "x1", "xyz"].filter(RegExp.prototype.test, /^x/);
console.log(results);
var results = ["x", "abc", "x1", "xyz"].filter(RegExp.prototype.test, /^x/);
console.log(results);