Logical operations in JavaScript - wordpress