for (const key in myobject) {
        if (Object.hasOwnProperty.call(myobject, key)) {
          const element = myobject[key];
        }
      }

      Typescript language logo
      For in

      TypeScript recipes

      The code is iterating through the myobject object, looking for a key called key. If it finds the key, it checks to see if it exists on Object.hasOwnProperty. If it does, it then retrieves the object at that key from myobject, and assigns it to element.

      Shortcut: for.in

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.