← Back to challenges

ES6: Recursive String Builder

JavaScriptHardrecursionstrings

Instructions

Write a getStringBuilder() function that returns an object. Any arbitrary property of that object will also be an object as will the properties of that object. Recursively. Invoking any of the child objects should return a string generated from the entire property chain.

Examples

getStringBuilder().Hello.there() ➞ "Hello there"

getStringBuilder().one.two.three.four() ➞ "one two three four"

getStringBuilder().we.live.in.a.society() ➞ "we live in a society"

Notes

N/A

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.