Maybe `if (element != undefined) {`?