1
I’m using the code below to search for data in a json, and it works perfectly in Chrome and Firefox, but in mobile browser it doesn’t work, and just doesn’t return anything:
function searchTitles(e){
    var val = decodeURI(e);
    var data = Object.values(meu_json).filter(function(objecto) { 
        return objecto.titulo.toLowerCase().indexOf(val.toLowerCase()) > -1 
    });
    if(data == ""){
        var data = Object.values(meu_json).filter(function(objecto) { 
            return objecto.categoria.toLowerCase().indexOf(val.toLowerCase()) > -1 
        });
    }
    if(data != ""){
        alert(data);
    }else {
        alert('error');
    }   
}
When using in Chrome or firefox it returns the data and data != "" but the same in a mobile browser, it doesn’t work, just nothing happens, no error message.
I believe the problem lies in
Object.valuesnot compatible with most browsers. Try changing byfor..inor aforclassic. Docs for compatibility purposes.– BrTkCa
Can you make an example with for in to see what @Lucascosta looks like
– Leo Letto
I answered with an example @Leoletto.
– BrTkCa