JSFiddle - React, Tailwind, and code Playground

by Rui Leite

HTML

<div id="saida"></div>

JavaScript

function buscar(arr, str){
    return arr.filter(function (val, idx, self) {
        return val.localeCompare(str);
    });
}

var palavras = [
    "acentuacao",
    "divagacão",
    "programaçao",
    "taxação"
];
var itens = buscar(palavras, "divagacão");
document.getElementById("saida").innerHTML = document.getElementById("saida").innerHTML.concat(itens);