DEV Community

Discussion on: No Optional Chaining? No Problem. Write Your Own deepGet Function!

Collapse
 
aminnairi profile image
Amin

Hi Nick!

Awesome usage of the rest operator in this context, I really like this API. this looks more natural than using a string or an array for accessing a chain of properties.

For the return type, I would have returned null instead of undefined. From my understanding, null represents the intentional absence of a value, while undefined is a declared value that has not been provided. But I may be wrong on this one. What do you think? Should this function return null rather than undefined?

Anyway, good take on this one!