Show Buttons
Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkdin
Share On Reddit
Contact us
Hide Buttons

function that returns a function until called without arguments in javascript


Write a function say which logs the following.

console.log( say('Foo')('bar')() ) // => "Foo bar "

console.log( say('Hi')('my')('name')('is')('Foo')() ) // "Hi my name is Foo "

Note: Solution does not use recursion. There is a difference between recursion and function returning a function.

Solution


You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *