-1
I am running a script on the Google console and get the error "Uncaught Syntaxerror: Unexpected end of input". I did not find the syntax error of this code, I searched in previous questions, here and here, but I couldn’t find anything that could tell me where the error of this code is. It follows the code I’m trying to run on the console:
<script>
var cidades = ["São Paulo", "Criciuma", "Curitiba", "Itajai", "Rio do Sul", "Erichim"];
for (var i = 0; i < cidades.legth; i++){
var str = cidades[i];
if(str.lenght == 8){
document.write(str);
document.write("|");
}
}
</script>
Would anyone know how to eliminate this error to run this example?
I fixed this error and circled, but it returns me "Undefined" instead of returning the names of the cities. Should not return the names this time?
– Alineat
It returns Undefined because, in fact, it is not a function, however, shows on your browser screen the cities Criciuma and Curitiba
– Taffarel Xavier