JSFiddle - React, Tailwind, and code Playground

JavaScript

var palavras = ['abelha','bufalo','cavalo','javali'];

var ret = palavras.filter(function(item){
   var inputValue = 'b';
   var regex = new RegExp(inputValue);   
   return item.match(regex);   
});

alert(ret);