Skip to content

Instantly share code, notes, and snippets.

@praveen-vishnu
Created February 12, 2023 10:47
Show Gist options
  • Save praveen-vishnu/e4f083d2605cb02739a2da92277defa1 to your computer and use it in GitHub Desktop.
Save praveen-vishnu/e4f083d2605cb02739a2da92277defa1 to your computer and use it in GitHub Desktop.
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())
let greet = function (a) {
return {
greet: function (b) {
return b ? greet(a + " " + b) : a;
}
}
};
console.log(greet('hello').greet('world').greet())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment