The _.allKeys()
function from the Underscore library can be used in Javascript to retrieve all the keys of an object, including its inherited properties. Here's an example of how to use it:
index.tsx361 chars17 lines
In this example, we first import the Underscore library using the require()
method. We then create an object called person
with some properties. We then add two more properties to the person object.
Finally, we use the _.allKeys()
function to retrieve all the keys of the person
object, including its inherited properties. The function returns an array of strings with all the keys, which we log to the console using the console.log()
method.
gistlibby LogSnag