.getKeys(keys)

Description

getKeys returns an array of the keys in an object

Parameters

if you give getKeys no parameters and you attach it to an object, it will return an array of the keys in an object.

If you give getKeys a single parameter for the key to get, and you attach it to an array of objects, it will return the values of that key in each item of the array

Usage On Objects

obj = {"key":"value","key2":"value2"}
// setup the object

log obj.getKeys()
// ["key","key2"]

Usage On Arrays

arr = [
  {"key":"value"},
  {},
  {"key":"wow"}
]
// setup the array

log arr.getKeys("key")
// ["value","","wow"]

Last updated