Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript return function

// Javascript double parentheses
// first function call result in a function that is called

function a() {
        return (name = 'b') => console.log(`I'm function ${name} produced by a()`);
}

a()();
a()('b2');

// result :
// I'm function b produced by a()
// I'm function b2 produced by a()
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #javascript #return #function
ADD COMMENT
Topic
Name
9+1 =