I am trying to write a function in JavaScript where there will be an infinite call to greet(). The expected outcome is to have the greetings concatenated with each call.
console.log(greet('hello').greet('world').greet())
the output of the above should give Hello world
and there might be infinite greet('string')
My initial implementation looked like this:
let greet = function (a) {
return function (a) {
return function (c){
return c ? (b + " " + c ) : (a + " " + b);
}
}
};
However, the output is not as expected. I am facing some issues in the implementation and would like some help in resolving them. Can someone help me fix this issue? Thank you in advance."