Delegation is common and useful in javasript programming. Here is a simple example, showing how to

function j(){alert("greater than 3");}

function validate(x, func){
  if(x>3){
    func();
  }}

validate(5,new j());
Advertisements