0
I started studying javascript recently and the following code is only giving me the wrong answer, where I went wrong?
When I play at the prompt to see if it’s right, it gives me "n1 is odd"
// Verifique se um número é par ou ímpar
var n1 = 4;
var sobra = n1%2;
if(sobra = 0){
console.log("n1 é par")
}else{
console.log("n1 é ímpar")
};
good morning, avoid is posting photo, it is better to post the same code, copy the paste code for a better view, so someone denied your question.
– Joan Marcos
and the error is quite simple, you are using the assignment operator and not comparison, the correct serious == and not =
– Joan Marcos
ai I did not know apokdaposkdapo, but brigade by tip
– Miyuki Fukagawa