I am searching for an improved way to write the following if
statement:
function addGestureendEvent(el) {
if (el.addEventListener && !el.eventListenerAdded) {
el.addEventListener('gestureend', doSomething, false);
el.eventListenerAdded = true;
}
};
Would it be more effective to explicitly check for the property? For example:
if (el.addEventListener && el.hasOwnProperty(‘eventListenerAdded’) {
…
}
Appreciate any suggestions. Thank you.