Why can’t I do this:
var fooElement, barElements;
if(fooElement = document.getElementById('foo') && barElements = fooElement.getElementsByTagName('bar') && barElements[0] && barElements[0].onclick)
{
console.log(barElements[0].onclick);
}
This won’t work either:
var foo, bar;
if(foo = true && bar = true)
{
console.log('yay');
}
Try this (it should give you a clue):