To use the keys function from Underscore library, the library first needs to be included in the project. This can be done by including a reference to the Underscore library in the HTML file, like so:
38 chars2 linesOnce the library is included, the keys function can be used to retrieve all the keys of an object as an array. Here is an example:
index.tsx222 chars9 linesIn this example, we defined an object called example_object, which has three properties. We then used the keys function from the Underscore library to retrieve an array of all the keys of the object. The resulting array, keys, contains the values ["a", "b", "c"].
gistlibby LogSnag