Home  >  Q&A  >  body text

javascript - Why does this return true?

[].every(function (item, index, arr) {

        })
某草草某草草2663 days ago799

reply all(1)I'll reply

  • 过去多啦不再A梦

    过去多啦不再A梦2017-07-05 10:57:01

    every search for each element, perform fallback on each element, if one of them returns false, it will finally return false

    The array here has no elements, so there is no element and returns false, so it ultimately returns true

    Similarly, [].some(function () {}) is also always false

    reply
    0
  • Cancelreply