Details
-
Bug
-
Resolution: Done
-
P4: Low
-
5.9
-
None
Description
http://doc.qt.io/qt-5/qtqml-typesystem-topic.html#javascript-types has the following example:
import QtQuick 2.0 Item { property var theArray: new Array() property var theDate: new Date() Component.onCompleted: { for (var i = 0; i < 10; i++) theArray.push("Item " + i) console.log("There are", theArray.length, "items in the array") console.log("The time is", theDate.toUTCString()) } }
Creator highlights this with a warning:
Do not use "Array" as a constructor
More info:
https://eslint.org/docs/rules/no-array-constructor
https://stackoverflow.com/a/1273936/904422
Attachments
Issue Links
- relates to
-
QTBUG-65890 "Models" section of "Models and Views in Qt Quick" does not mention arrays
- Open
For Gerrit Dashboard: QTBUG-65891 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
235683,2 | Doc: Use [] instead of new Array() in snippet | 5.11 | qt/qtdeclarative | Status: MERGED | +2 | 0 |
235694,2 | Doc: Use [] instead of new Array() in snippet | 5.9 | qt/qtdeclarative | Status: MERGED | +2 | 0 |