Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-81825

Javascript Array.includes can return false when Array.indexOf doesn't return -1

    XMLWordPrintable

Details

    • a8bc011d459a4d080815a2675f2a0413c8bf09d2 (qt/qtdeclarative/5.15)

    Description

      It seems that Array.includes doesn't check equality like Array.indexOf.
      Array.indexOf behaves as expected but includes doesn't:
      [(Qt.point(0, 0)].includes(Qt.point(0, 0)) returns false

      Note the second attachment and the differences when using object properties or local javascript variables as array elements.
      Everyline line should return true.

      Attachments

        1. property_vs_localvar.qml
          0.4 kB
        2. main.qml
          1 kB

        Activity

          People

            fabiankosmale Fabian Kosmale
            grecko Pierre-Yves Siret
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: