Can you please explain why would the return function in doctor1 function bellow could be better that the one in the doctor 2?
//-----------------Doctor 1--------------------------
function doctor1() {
return function() { alert("How are you, today?"); };
}
var x = doctor1();
x();
//-----------------Doctor 2--------------------------
function doctor2() {
return alert("How are you, today?");
}
doctor2();
//-------------------------------------------