Created
February 12, 2023 10:47
-
-
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())
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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