What is the difference - if there is a difference - between functions ex1() and ex2()? Does the way of defining fun1 inside the body of ex1 have benefits over the way of defining in ex2?
function ex1() {
var fun1 = function () { return 0; };
var x = fun1();
}
function ex2() {
function fun1() { return 0; }
var x = fun1();
}