Javascript Function Closure Nested Function Create

Description

Javascript Function Closure Nested Function Create



// Nesting functions
function addSquare(a,b) {
    function multiply(x,y) {
        return x*y;
    }/*from  w w w  .ja  v a  2s  .com*/
    return multiply((a+b),(a+b));
}
console.log( addSquare(3,4) );     // 49



PreviousNext

Related