I was analyzing websites when I came across the following excerpt:
if (console.log(i), i && void 0 !== i.name) {
// code here...
}
I tested this:
var i = {name: "mizuk"};
if (console.log(i), i && void 0 !== i.name) {
console.log("condição verdadeira!");
}
What I understood from the code was:
// se 'i' não estiver vazio e 'i.name' não tiver o mesmo valor e tipo
// que 'undefined' faça:
What I want to know is:
- > where does 'console.log (i)' come in?, is it part of the condition or was it simply called in the middle of the sentence?
- > if it was called, is this something common or is it a gambiarra?
- > if it's something common, can I perform other functions that way?
Thank you in advance for your help.