-1
I need an algorithm that reads an array, and returns me if one of the items has a letter... if one of the items has a letter, I want it to return me "qualitative", if all the elements have only numbers, I want it to return me "quantitative"... I made a scheme of him to erase the comma and the point so that there is no confusion at the time d check if it has only numbers or letters if the user enters with decimal numbers using either dot or comma... but anyway, if anyone can help me I really appreciate... that code is running perfectly on Chrome’s Navigator, but when I try to use it on my college job at NODEJS, it does not rotate... a, and detail kk the elements of the vector will reach me all in string... does anyone know how to explain tmb the reason the code runs in the browser and in Node js not? From now on, I thank you
var meucarro = ["19.98", "993", "228", "opal"];
function verIsNaN(vetorEntrada) {
var vetor = vetorEntrada
var er = /^[0-9]+$/;
let resposta = "quantitativa"
for (let i = 0; i < vetor.length; i++) {
if (vetor[i].indexOf(","))
vetor[i] = vetor[i].replace(/[,.]+/g, '');
if ((er.test(vetor[i])) === false) {
resposta = "qualitativo"
};
}
console.log(resposta)
}
verIsNaN(meucarro);