What does verify & & verify () mean?

it can"t be and. No, no, no.

Mar.07,2021

call verify if you have verify


& & the left side is implicitly converted to boolean

function verify() {
    return 123
}

let result = verify && verify();// -> true && verify() -> verify() -> 123

translated into vernacular means "execute the verify method if verify exists". & & is short-circuit writing, preceded by true to execute the following statement.


if (verify) {
    verify()
}
Menu