jeudi 31 mars 2016

"confirm" in function. How can "confirm" starts if it's located only inside "if"?

Here is the code. Could you please explain how the "confirm" works here. It just says, that: "if there is the "confirm" but the is no command "confirm" in fact.

function ask(question, yes, no) {
    if (confirm(question)) {
        yes()
    }
    else {
        no();
    }
  }
function showOk() {
  alert( "You are agree." );
}

function showCancel() {
  alert( "You cancelled." );
}
ask("Are you agree?", showOk, showCancel);

Aucun commentaire:

Enregistrer un commentaire