Jump to content

Object's key names


smus
 Share

Recommended Posts

A recursive function is the easiest way to do it, but it's possible to replace any recursive function with an iterative process and stack memory, though I would advise against it since it's messy.

Link to comment
Share on other sites

Yeah, true, same info is on StackOverflow: different implementatoins of recursive approach. Strange that ES6 doesn't have a built-in function or method for it. Object.hasOwnProperty is only for the upper-level keys which makes it useless for structured objects.

Link to comment
Share on other sites

I don't see any practical reason to search for all keys at every level inside an object. If they don't build such a feature into the language it's probably to discourage people from doing it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...