Q:

function inside function javascript

function OuterFunction() {

    var outerVariable = 100;

    function InnerFunction() {
        alert(outerVariable);
    }

    return InnerFunction;
}
var innerFunc = OuterFunction();

innerFunc(); // 100
2
function x() {
};

x.y = function() { alert('2');};

function z() {  x.y(); }
0
function getFullName() {
	return getName() + ' ' + getLastName();
  	function getName() {
    	return 'William';
    }
  	function getLastName() {
    	return 'Wallace';
    }
}

console.log(getFullName());
//William Wallace
console.log(typeof getFullName);
//function
console.log(typeof getName);
//undefined
console.log(typeof getLastName);
//undefined
0

New to Communities?

Join the community