Function passing

Asked

Viewed 712 times

-2

Run a function called passWhy you print on the console "here I have the value of x" where x will be the value of i in each iteration, for each value from 0 to 3.

Only it gives this error message:

inserir a descrição da imagem aqui

You could check, if the code below is correct:

Passing Function() {

is (var i = 0; i <4; i++){

console.log("aqui eu tenho o valor de ",i);   

}

}

passing by();

  • was also asked here https://answall.com/questions/424900/exerc%C3%adcio-repeti%C3%A7%C3%a3o

  • here for me this code ran normal, Voce ran in the browser ?

  • Yes, in the Chrome browser it works normally. In the site console it works too, only when you test for error.

1 answer

0

You forgot to concatenate your sentence into console.log with the symbol of +

function passandoPor() {
  for(var i = 0; i < 4; i++) {

    console.log("aqui eu tenho o valor de " + i);

  }
}
  • The problem still persists!

  • 1

    @Abriel does not need to concatenate with the + a , already done in this case

Browser other questions tagged

You are not signed in. Login or sign up in order to post.