{
  "doc": {
    "id": "api/commands/each",
    "title": "cy.each()",
    "description": "Iterate through an array like structure in Cypress (arrays or objects with a length property).",
    "section": "api",
    "source_path": "/llm/markdown/api/commands/each.md",
    "version": "5a232a3cf094b8f928b1179ce5af6a5046296fac",
    "updated_at": "2026-11-13T01:14:31.437Z",
    "headings": [
      {
        "id": "api/commands/each#each",
        "text": "each",
        "level": 1
      },
      {
        "id": "api/commands/each#syntax",
        "text": "Syntax",
        "level": 2
      },
      {
        "id": "api/commands/each#usage",
        "text": "Usage",
        "level": 3
      },
      {
        "id": "api/commands/each#arguments",
        "text": "Arguments",
        "level": 3
      },
      {
        "id": "api/commands/each#yields",
        "text": "Yields",
        "level": 3
      },
      {
        "id": "api/commands/each#examples",
        "text": "Examples",
        "level": 2
      },
      {
        "id": "api/commands/each#dom-elements",
        "text": "DOM Elements",
        "level": 3
      },
      {
        "id": "api/commands/each#arrays",
        "text": "Arrays",
        "level": 3
      },
      {
        "id": "api/commands/each#promises",
        "text": "Promises",
        "level": 3
      },
      {
        "id": "api/commands/each#options",
        "text": "Options",
        "level": 3
      },
      {
        "id": "api/commands/each#notes",
        "text": "Notes",
        "level": 2
      },
      {
        "id": "api/commands/each#prefer-should-for-assertions-on-every-element",
        "text": "Prefer .should() for assertions on every element",
        "level": 3
      },
      {
        "id": "api/commands/each#return-early",
        "text": "Return early",
        "level": 3
      },
      {
        "id": "api/commands/each#empty-collections",
        "text": "Empty collections",
        "level": 3
      },
      {
        "id": "api/commands/each#callback-return-values",
        "text": "Callback return values",
        "level": 3
      },
      {
        "id": "api/commands/each#rules",
        "text": "Rules",
        "level": 2
      },
      {
        "id": "api/commands/each#requirements",
        "text": "Requirements",
        "level": 3
      },
      {
        "id": "api/commands/each#assertions",
        "text": "Assertions",
        "level": 3
      },
      {
        "id": "api/commands/each#timeouts",
        "text": "Timeouts",
        "level": 3
      },
      {
        "id": "api/commands/each#command-log",
        "text": "Command Log",
        "level": 2
      },
      {
        "id": "api/commands/each#see-also",
        "text": "See also",
        "level": 2
      }
    ]
  },
  "chunks": [
    {
      "id": "api/commands/each#syntax",
      "doc_id": "api/commands/each",
      "heading": "Syntax",
      "heading_level": 2,
      "content_markdown": "## Syntax\n\n```\n.each(callbackFn)\n.each(options, callbackFn)\n```\n\n### Usage\n\n**Correct Usage**\n\n```\ncy.get('ul>li').each(() => {...}) // Iterate through each 'li'\ncy.getCookies().each(() => {...}) // Iterate through each cookie\n```\n\n**Incorrect Usage**\n\n```\ncy.each(() => {...})            // Errors, cannot be chained off 'cy'\ncy.clock().each(() => {...})    // Errors, 'clock' does not yield an array\n```\n\n### Arguments\n\n**options _(Object)_**\n\nPass in an options object to change the default behavior of `.each()`.\n\n| Option | Default | Description |\n| --- | --- | --- |\n| `timeout` | [`defaultCommandTimeout`](/llm/markdown/app/references/configuration.md#Timeouts) | Time to wait for each invocation of the callback function to resolve before [timing out](#Timeouts) |\n\n**callbackFn _(Function)_**\n\nPass a function that is invoked with the following arguments:\n\n*   `value` - the current item in the collection. If the item is a DOM element, Cypress wraps it in jQuery before passing it to the callback.\n*   `index` - the 0-based index of the current item in the collection\n*   `collection` - the original collection being iterated over\n\n### Yields\n\n*   `.each()` yields the same subject it was given.\n*   Because `.each()` is not a [query](/llm/markdown/app/core-concepts/retry-ability.md#Only-queries-are-retried), it is unsafe to chain further commands that act or assert on DOM elements after `.each()`, as those elements may have re-rendered and gone stale during iteration. Reading the yielded subject in a [`.then()`](/llm/markdown/api/commands/then.md) callback (as in the example below) is safe.\n",
      "section": "api",
      "anchors": [
        "syntax"
      ],
      "path": "/llm/json/chunked/api/commands/each.json",
      "token_estimate": 301
    },
    {
      "id": "api/commands/each#usage",
      "doc_id": "api/commands/each",
      "heading": "Usage",
      "heading_level": 3,
      "content_markdown": "### Usage\n\n**Correct Usage**\n\n```\ncy.get('ul>li').each(() => {...}) // Iterate through each 'li'\ncy.getCookies().each(() => {...}) // Iterate through each cookie\n```\n\n**Incorrect Usage**\n\n```\ncy.each(() => {...})            // Errors, cannot be chained off 'cy'\ncy.clock().each(() => {...})    // Errors, 'clock' does not yield an array\n```\n",
      "section": "api",
      "anchors": [
        "usage"
      ],
      "path": "/llm/json/chunked/api/commands/each.json",
      "token_estimate": 63
    },
    {
      "id": "api/commands/each#arguments",
      "doc_id": "api/commands/each",
      "heading": "Arguments",
      "heading_level": 3,
      "content_markdown": "### Arguments\n\n**options _(Object)_**\n\nPass in an options object to change the default behavior of `.each()`.\n\n| Option | Default | Description |\n| --- | --- | --- |\n| `timeout` | [`defaultCommandTimeout`](/llm/markdown/app/references/configuration.md#Timeouts) | Time to wait for each invocation of the callback function to resolve before [timing out](#Timeouts) |\n\n**callbackFn _(Function)_**\n\nPass a function that is invoked with the following arguments:\n\n*   `value` - the current item in the collection. If the item is a DOM element, Cypress wraps it in jQuery before passing it to the callback.\n*   `index` - the 0-based index of the current item in the collection\n*   `collection` - the original collection being iterated over\n",
      "section": "api",
      "anchors": [
        "arguments"
      ],
      "path": "/llm/json/chunked/api/commands/each.json",
      "token_estimate": 149
    },
    {
      "id": "api/commands/each#yields",
      "doc_id": "api/commands/each",
      "heading": "Yields",
      "heading_level": 3,
      "content_markdown": "### Yields\n\n*   `.each()` yields the same subject it was given.\n*   Because `.each()` is not a [query](/llm/markdown/app/core-concepts/retry-ability.md#Only-queries-are-retried), it is unsafe to chain further commands that act or assert on DOM elements after `.each()`, as those elements may have re-rendered and gone stale during iteration. Reading the yielded subject in a [`.then()`](/llm/markdown/api/commands/then.md) callback (as in the example below) is safe.\n",
      "section": "api",
      "anchors": [
        "yields"
      ],
      "path": "/llm/json/chunked/api/commands/each.json",
      "token_estimate": 80
    },
    {
      "id": "api/commands/each#examples",
      "doc_id": "api/commands/each",
      "heading": "Examples",
      "heading_level": 2,
      "content_markdown": "## Examples\n\n### DOM Elements\n\n**Iterate over an array of DOM elements**\n\nEach element arrives in the callback wrapped in jQuery, so you can read its state with jQuery methods. Wrap it with [`cy.wrap()`](/llm/markdown/api/commands/wrap.md) to run Cypress commands on it.\n\n```\ncy.get('[data-cy=\"product-card\"]').each(($card) => {\n  if ($card.find('[data-cy=\"sold-out\"]').length) {\n    cy.wrap($card).find('button').should('be.disabled')\n  } else {\n    cy.wrap($card).find('button').should('be.enabled')\n  }\n})\n```\n\n**Assert the expected length before iterating**\n\n[`cy.get()`](/llm/markdown/api/commands/get.md) resolves as soon as it finds at least one matching element, and `.each()` does not retry. If your application renders a list in stages, `.each()` iterates only the items that exist at that moment. Assert on the expected length first so the test waits for every item.\n\n```\ncy.get('[data-cy=\"result\"]')\n  .should('have.length', 2)\n  .each(($result) => {\n    cy.wrap($result).should('contain', 'Cypress')\n  })\n```\n\n**Scope commands to each element with `.within()`**\n\n```\ncy.get('table tbody tr').each(($row) => {\n  cy.wrap($row).within(() => {\n    cy.get('td').eq(2).should('not.be.empty')\n  })\n})\n```\n\n**Re-query by index when an action changes the page**\n\nIf an action in the callback navigates away or re-renders the list, the elements `.each()` passes in are detached from the DOM. Use `index` to query a fresh element on every iteration instead.\n\n```\ncy.get('nav a').each(($link, index) => {\n  cy.get('nav a').eq(index).click()\n  cy.go('back')\n})\n```\n\n**Collect results from Cypress commands, then assert once**\n\nWhen each item needs a Cypress command, such as a request, gather the results in the callback and assert on all of them in a [`.then()`](/llm/markdown/api/commands/then.md) that runs after the loop finishes. This test reports every broken link at once instead of stopping at the first one.\n\n```\nconst broken = []\n\ncy.get('footer a')\n  .each(($link) => {\n    cy.wrap($link)\n      .invoke('prop', 'href')\n      .then((href) => {\n        cy.request({ url: href, failOnStatusCode: false }).then((response) => {\n          if (response.status >= 400) {\n            broken.push(`${href} (${response.status})`)\n          }\n        })\n      })\n  })\n  .then(() => {\n    // list the links in the message, since Chai shortens long arrays\n    expect(broken, `broken links: ${broken.join(', ')}`).to.be.empty\n  })\n```\n\nIf you only need to read values from the elements, such as their text, use a [`.should()` callback](#Prefer-should-for-assertions-on-every-element) instead.\n\n**The original collection is always yielded**\n\nNo matter what the callback function returns, `.each()` always yields the original collection.\n\n```\ncy.get('li')\n  .should('have.length', 3)\n  .each(($li, index, $lis) => {\n    return 'something else'\n  })\n  .then(($lis) => {\n    expect($lis).to.have.length(3) // true\n  })\n```\n\nHere the `.then()` callback only _reads_ the yielded array, which is safe. If instead you needed to act or assert on DOM elements that your application may have re-rendered during iteration, re-query them with a Cypress query rather than reusing the subject yielded by `.each()`.\n\n### Arrays\n\n**Iterate over fixture data**\n\n`.each()` works on any array, not only DOM elements. Cypress commands you call in the callback run in order, one item at a time.\n\n```\n// users.json contains an array of user objects\ncy.fixture('users.json').each((user) => {\n  cy.request('POST', '/api/users', user).its('status').should('eq', 201)\n})\n```\n\n### Promises\n\n**Promises are awaited**\n\nIf your callback function returns a `Promise`, `.each()` waits for it to resolve before iterating over the next item in the collection.\n\n```\ncy.wrap([1, 2, 3]).each((num, i, array) => {\n  return new Cypress.Promise((resolve) => {\n    setTimeout(() => {\n      resolve()\n    }, num * 100)\n  })\n})\n```\n\n### Options\n\n**Wait longer for each callback to resolve**\n\nThe `timeout` option applies to each invocation of the callback, not to the loop as a whole.\n\n```\ncy.getCookies().each({ timeout: 10000 }, (cookie) => {\n  return new Cypress.Promise((resolve) => {\n    // work with each cookie, then resolve\n    resolve()\n  })\n})\n```\n",
      "section": "api",
      "anchors": [
        "examples"
      ],
      "path": "/llm/json/chunked/api/commands/each.json",
      "token_estimate": 744
    },
    {
      "id": "api/commands/each#dom-elements",
      "doc_id": "api/commands/each",
      "heading": "DOM Elements",
      "heading_level": 3,
      "content_markdown": "### DOM Elements\n\n**Iterate over an array of DOM elements**\n\nEach element arrives in the callback wrapped in jQuery, so you can read its state with jQuery methods. Wrap it with [`cy.wrap()`](/llm/markdown/api/commands/wrap.md) to run Cypress commands on it.\n\n```\ncy.get('[data-cy=\"product-card\"]').each(($card) => {\n  if ($card.find('[data-cy=\"sold-out\"]').length) {\n    cy.wrap($card).find('button').should('be.disabled')\n  } else {\n    cy.wrap($card).find('button').should('be.enabled')\n  }\n})\n```\n\n**Assert the expected length before iterating**\n\n[`cy.get()`](/llm/markdown/api/commands/get.md) resolves as soon as it finds at least one matching element, and `.each()` does not retry. If your application renders a list in stages, `.each()` iterates only the items that exist at that moment. Assert on the expected length first so the test waits for every item.\n\n```\ncy.get('[data-cy=\"result\"]')\n  .should('have.length', 2)\n  .each(($result) => {\n    cy.wrap($result).should('contain', 'Cypress')\n  })\n```\n\n**Scope commands to each element with `.within()`**\n\n```\ncy.get('table tbody tr').each(($row) => {\n  cy.wrap($row).within(() => {\n    cy.get('td').eq(2).should('not.be.empty')\n  })\n})\n```\n\n**Re-query by index when an action changes the page**\n\nIf an action in the callback navigates away or re-renders the list, the elements `.each()` passes in are detached from the DOM. Use `index` to query a fresh element on every iteration instead.\n\n```\ncy.get('nav a').each(($link, index) => {\n  cy.get('nav a').eq(index).click()\n  cy.go('back')\n})\n```\n\n**Collect results from Cypress commands, then assert once**\n\nWhen each item needs a Cypress command, such as a request, gather the results in the callback and assert on all of them in a [`.then()`](/llm/markdown/api/commands/then.md) that runs after the loop finishes. This test reports every broken link at once instead of stopping at the first one.\n\n```\nconst broken = []\n\ncy.get('footer a')\n  .each(($link) => {\n    cy.wrap($link)\n      .invoke('prop', 'href')\n      .then((href) => {\n        cy.request({ url: href, failOnStatusCode: false }).then((response) => {\n          if (response.status >= 400) {\n            broken.push(`${href} (${response.status})`)\n          }\n        })\n      })\n  })\n  .then(() => {\n    // list the links in the message, since Chai shortens long arrays\n    expect(broken, `broken links: ${broken.join(', ')}`).to.be.empty\n  })\n```\n\nIf you only need to read values from the elements, such as their text, use a [`.should()` callback](#Prefer-should-for-assertions-on-every-element) instead.\n\n**The original collection is always yielded**\n\nNo matter what the callback function returns, `.each()` always yields the original collection.\n\n```\ncy.get('li')\n  .should('have.length', 3)\n  .each(($li, index, $lis) => {\n    return 'something else'\n  })\n  .then(($lis) => {\n    expect($lis).to.have.length(3) // true\n  })\n```\n\nHere the `.then()` callback only _reads_ the yielded array, which is safe. If instead you needed to act or assert on DOM elements that your application may have re-rendered during iteration, re-query them with a Cypress query rather than reusing the subject yielded by `.each()`.\n",
      "section": "api",
      "anchors": [
        "dom-elements"
      ],
      "path": "/llm/json/chunked/api/commands/each.json",
      "token_estimate": 543
    },
    {
      "id": "api/commands/each#arrays",
      "doc_id": "api/commands/each",
      "heading": "Arrays",
      "heading_level": 3,
      "content_markdown": "### Arrays\n\n**Iterate over fixture data**\n\n`.each()` works on any array, not only DOM elements. Cypress commands you call in the callback run in order, one item at a time.\n\n```\n// users.json contains an array of user objects\ncy.fixture('users.json').each((user) => {\n  cy.request('POST', '/api/users', user).its('status').should('eq', 201)\n})\n```\n",
      "section": "api",
      "anchors": [
        "arrays"
      ],
      "path": "/llm/json/chunked/api/commands/each.json",
      "token_estimate": 64
    },
    {
      "id": "api/commands/each#promises",
      "doc_id": "api/commands/each",
      "heading": "Promises",
      "heading_level": 3,
      "content_markdown": "### Promises\n\n**Promises are awaited**\n\nIf your callback function returns a `Promise`, `.each()` waits for it to resolve before iterating over the next item in the collection.\n\n```\ncy.wrap([1, 2, 3]).each((num, i, array) => {\n  return new Cypress.Promise((resolve) => {\n    setTimeout(() => {\n      resolve()\n    }, num * 100)\n  })\n})\n```\n",
      "section": "api",
      "anchors": [
        "promises"
      ],
      "path": "/llm/json/chunked/api/commands/each.json",
      "token_estimate": 68
    },
    {
      "id": "api/commands/each#options",
      "doc_id": "api/commands/each",
      "heading": "Options",
      "heading_level": 3,
      "content_markdown": "### Options\n\n**Wait longer for each callback to resolve**\n\nThe `timeout` option applies to each invocation of the callback, not to the loop as a whole.\n\n```\ncy.getCookies().each({ timeout: 10000 }, (cookie) => {\n  return new Cypress.Promise((resolve) => {\n    // work with each cookie, then resolve\n    resolve()\n  })\n})\n```\n",
      "section": "api",
      "anchors": [
        "options"
      ],
      "path": "/llm/json/chunked/api/commands/each.json",
      "token_estimate": 67
    },
    {
      "id": "api/commands/each#notes",
      "doc_id": "api/commands/each",
      "heading": "Notes",
      "heading_level": 2,
      "content_markdown": "## Notes\n\n### Prefer `.should()` for assertions on every element\n\n**Use a `.should()` callback when you only need to assert**\n\n`.each()` runs its callback once and does not [retry](/llm/markdown/app/core-concepts/retry-ability.md). When all you need is an assertion about every element, a [`.should()` callback](/llm/markdown/api/commands/should.md#Function) reruns until the assertions pass or time out, so it tolerates elements that are still rendering or updating.\n\n```\ncy.get('[data-cy=\"result\"]').should(($results) => {\n  expect($results).to.have.length.greaterThan(0)\n\n  $results.each((index, result) => {\n    expect(result.textContent).to.contain('Cypress')\n  })\n})\n```\n\nBecause the whole callback reruns, the same pattern works for checks on the list as a whole, such as sort order after your application applies a sort.\n\n```\ncy.get('[data-cy=\"price\"]').should(($prices) => {\n  const prices = [...$prices].map((price) =>\n    Number(price.textContent.replace('$', ''))\n  )\n\n  expect(prices).to.deep.equal([...prices].sort((a, b) => a - b))\n})\n```\n\nChaining `.should()` after `.each()` does not give you this retry. `.should()` reruns only its own callback, not `.each()`, so it keeps checking values collected from the list as it was when `.each()` ran.\n\nKeep `.each()` for work that needs Cypress commands per item, such as clicking, typing, or making requests.\n\n### Return early\n\n**Stop `each` prematurely**\n\nYou can stop the `.each()` loop early by returning `false` in the callback function. The callback must return `false` synchronously. A `Promise` that resolves to `false` does not stop the loop.\n\n```\ncy.get('ul>li').each(($li) => {\n  if ($li.hasClass('last-visible')) {\n    // stop iterating after this item\n    return false\n  }\n})\n```\n\n### Empty collections\n\n**The callback is not invoked for an empty collection**\n\nWhen the subject has a `length` of `0`, `.each()` skips the callback entirely and yields the empty subject. It does not fail or wait for items to appear.\n\nA DOM query such as [`cy.get()`](/llm/markdown/api/commands/get.md) fails when no elements match, so an empty subject usually comes from non-DOM data, such as `cy.wrap([])`, [`cy.fixture()`](/llm/markdown/api/commands/fixture.md), or [`cy.getCookies()`](/llm/markdown/api/commands/getcookies.md). Assert on the length first when the data should never be empty.\n\n### Callback return values\n\n**Don't mix Cypress commands with a synchronous return value**\n\nThe callback follows the same rules as a [`.then()`](/llm/markdown/api/commands/then.md) callback. If it calls Cypress commands **and** returns a truthy synchronous value (anything other than a falsy value or a `Promise`\\-like object with a `.then()` method), Cypress throws an error because you are mixing up async and sync code. Whatever the callback returns, `.each()` still yields the original collection.\n",
      "section": "api",
      "anchors": [
        "notes"
      ],
      "path": "/llm/json/chunked/api/commands/each.json",
      "token_estimate": 499
    },
    {
      "id": "api/commands/each#prefer-should-for-assertions-on-every-element",
      "doc_id": "api/commands/each",
      "heading": "Prefer .should() for assertions on every element",
      "heading_level": 3,
      "content_markdown": "### Prefer `.should()` for assertions on every element\n\n**Use a `.should()` callback when you only need to assert**\n\n`.each()` runs its callback once and does not [retry](/llm/markdown/app/core-concepts/retry-ability.md). When all you need is an assertion about every element, a [`.should()` callback](/llm/markdown/api/commands/should.md#Function) reruns until the assertions pass or time out, so it tolerates elements that are still rendering or updating.\n\n```\ncy.get('[data-cy=\"result\"]').should(($results) => {\n  expect($results).to.have.length.greaterThan(0)\n\n  $results.each((index, result) => {\n    expect(result.textContent).to.contain('Cypress')\n  })\n})\n```\n\nBecause the whole callback reruns, the same pattern works for checks on the list as a whole, such as sort order after your application applies a sort.\n\n```\ncy.get('[data-cy=\"price\"]').should(($prices) => {\n  const prices = [...$prices].map((price) =>\n    Number(price.textContent.replace('$', ''))\n  )\n\n  expect(prices).to.deep.equal([...prices].sort((a, b) => a - b))\n})\n```\n\nChaining `.should()` after `.each()` does not give you this retry. `.should()` reruns only its own callback, not `.each()`, so it keeps checking values collected from the list as it was when `.each()` ran.\n\nKeep `.each()` for work that needs Cypress commands per item, such as clicking, typing, or making requests.\n",
      "section": "api",
      "anchors": [
        "prefer-should-for-assertions-on-every-element"
      ],
      "path": "/llm/json/chunked/api/commands/each.json",
      "token_estimate": 224
    },
    {
      "id": "api/commands/each#return-early",
      "doc_id": "api/commands/each",
      "heading": "Return early",
      "heading_level": 3,
      "content_markdown": "### Return early\n\n**Stop `each` prematurely**\n\nYou can stop the `.each()` loop early by returning `false` in the callback function. The callback must return `false` synchronously. A `Promise` that resolves to `false` does not stop the loop.\n\n```\ncy.get('ul>li').each(($li) => {\n  if ($li.hasClass('last-visible')) {\n    // stop iterating after this item\n    return false\n  }\n})\n```\n",
      "section": "api",
      "anchors": [
        "return-early"
      ],
      "path": "/llm/json/chunked/api/commands/each.json",
      "token_estimate": 73
    },
    {
      "id": "api/commands/each#empty-collections",
      "doc_id": "api/commands/each",
      "heading": "Empty collections",
      "heading_level": 3,
      "content_markdown": "### Empty collections\n\n**The callback is not invoked for an empty collection**\n\nWhen the subject has a `length` of `0`, `.each()` skips the callback entirely and yields the empty subject. It does not fail or wait for items to appear.\n\nA DOM query such as [`cy.get()`](/llm/markdown/api/commands/get.md) fails when no elements match, so an empty subject usually comes from non-DOM data, such as `cy.wrap([])`, [`cy.fixture()`](/llm/markdown/api/commands/fixture.md), or [`cy.getCookies()`](/llm/markdown/api/commands/getcookies.md). Assert on the length first when the data should never be empty.\n",
      "section": "api",
      "anchors": [
        "empty-collections"
      ],
      "path": "/llm/json/chunked/api/commands/each.json",
      "token_estimate": 104
    },
    {
      "id": "api/commands/each#callback-return-values",
      "doc_id": "api/commands/each",
      "heading": "Callback return values",
      "heading_level": 3,
      "content_markdown": "### Callback return values\n\n**Don't mix Cypress commands with a synchronous return value**\n\nThe callback follows the same rules as a [`.then()`](/llm/markdown/api/commands/then.md) callback. If it calls Cypress commands **and** returns a truthy synchronous value (anything other than a falsy value or a `Promise`\\-like object with a `.then()` method), Cypress throws an error because you are mixing up async and sync code. Whatever the callback returns, `.each()` still yields the original collection.\n",
      "section": "api",
      "anchors": [
        "callback-return-values"
      ],
      "path": "/llm/json/chunked/api/commands/each.json",
      "token_estimate": 95
    },
    {
      "id": "api/commands/each#rules",
      "doc_id": "api/commands/each",
      "heading": "Rules",
      "heading_level": 2,
      "content_markdown": "## Rules\n\n### Requirements\n\n*   `.each()` requires being chained off a previous command.\n*   `.each()` requires its subject to have a `length` property, such as an array or a jQuery collection. Any other subject fails with an error.\n\n### Assertions\n\n*   `.each()` will only run assertions you have chained once, and will not [retry](/llm/markdown/app/core-concepts/retry-ability.md).\n\n### Timeouts\n\n*   `.each()` can time out waiting for a promise you've returned to resolve. The timeout applies to each invocation of the callback and defaults to [`defaultCommandTimeout`](/llm/markdown/app/references/configuration.md#Timeouts).\n",
      "section": "api",
      "anchors": [
        "rules"
      ],
      "path": "/llm/json/chunked/api/commands/each.json",
      "token_estimate": 109
    },
    {
      "id": "api/commands/each#requirements",
      "doc_id": "api/commands/each",
      "heading": "Requirements",
      "heading_level": 3,
      "content_markdown": "### Requirements\n\n*   `.each()` requires being chained off a previous command.\n*   `.each()` requires its subject to have a `length` property, such as an array or a jQuery collection. Any other subject fails with an error.\n",
      "section": "api",
      "anchors": [
        "requirements"
      ],
      "path": "/llm/json/chunked/api/commands/each.json",
      "token_estimate": 48
    }
  ]
}