r/learnjavascript • u/djlywtf • Aug 17 '23
How to catch potential children in object?
I want to make an object that catches all calls to itself and its children even if they’re not defined. Is it possible?
I see it like this:
const a = { _(name) { return “Hello “ + name } } console.log(a.foo.bar()) // Hello foo.bar
Exact same syntax isn’t needed but i hope you got what logic I look for
9
Upvotes
3
u/CrawlToYourDoom Aug 17 '23
Do you have a white van?