Question:
Good morning, I'm trying to make an if whose condition is the result of a console.log
But I have no idea how to make the comparison because I'm new to JavaScript, would it be more or less like this??
Because it always returns the condition true 🙁
if(console.log(ev.target.tagName) == DIV)}
alert("O log retornou DIV");
} else {
alert("O log retornou IMG");
}
Answer:
The console.log()
function is for showing something in the browser console.
Make your condition without the console.log that should work, like this:
if(ev.target.tagName == 'DIV')}
alert("O log retornou DIV");
} else {
alert("O log retornou IMG");
}