Reputation: 2514
I have a check to see if the element has been drawn already by doing
if(element)
so I can choose whether to update the element or to draw it a new.
this works before the element is drawn, but not after element.remove()
even though if I use
alert(element);
I'm seeing undefined, which should be falsey.
Can anyone explain this?
Upvotes: 0
Views: 39
Reputation: 4530
This should work for both cases, if element is falsy or if it is a string 'undefined' (as @Gwyn Howell mentioned in the comment):
if( !!element && element!=='undefined' )
Upvotes: 2