uft
    Preparing search index...

    Function forEachKey

    • Calls a function for each key in an object.

      Type Parameters

      • T extends object

      Parameters

      • obj: T

        The object to iterate over.

      • callback: (key: CoerceString<keyof T>, obj: T) => void

        The function to call for each key where the first argument is the key and the second is obj.

      Returns void

      Keys are the object's own enumerable string-keyed property names, the same as those returned by Object.keys().

      forEachKey({ a: 1, b: 2, c: 3 }, (key, obj) => {
      key // type: 'a', 'b', 'c'
      console.log(obj[key])
      }) // Prints: 1, 2, 3