I am not so expert in JavaScript and I am wonder if there is a way to test the boolean value of a variable in javascript.
In Python I can do this:
>>>list_var = []
>>>bool(list_var)
False # This is the boolean value of a empty list
>>>
And if I try get an element in JS that does not exist, i.e:
document.getElementById('b-advanced')
[] // This is what returns
Is there a way to test the expression above as boolean without using an if... statement?
EDIT
I think I need to point something.
This is the full expression I use:
angular.element(document.getElementById('b-advanced'))
getElementByIdwould never return an array. It either returns a DOM element ornull.angular.element()function.