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

      Javascript language logo
      Forin

      My JavaScript recipes

      The code block will iterate through the object and check to see if the key exists in the Object object. If it does, then it will get the value stored at the key in the object and assign it to the element variable.

      Shortcut: for.in

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.