Important: Please read the Qt Code of Conduct -

What parts of ECMAScript 7 are supported in Qt 5.12?

  • In the Qt 5.12 What's New documentation it states that:
    "The JavaScript engine now supports ECMAScript 7. This includes an upgrade to ECMAScript 6"
    However, it seems that there is only partial support for ECMAScript 7. Promises work (but are buggy) but arrow functions don't. Is there something I can reference other than this closed JIRA issue to give an official list of supported features? Or can someone tell me what's wrong with this code?

    import QtQuick 2.12
    import QtQuick.Window 2.12
    Window {
        visible: true
        width: 640
        height: 480
        title: qsTr("Hello World")
        Component.onCompleted: {
            const test = [1,2,3,4,5,6,7,8,9,];
            test.forEach(t => console.log(t));

  • Lifetime Qt Champion


    For that kind of question you should go to the interest mailing list. You'll find there Qt's developers/maintainers. This forum is more user oriented.

  • Thanks @SGaist. From this StackOverflow post I found that the problem was that the version of Qt Creator that ships with 5.12 doesn't support the new ECMAScript 7 syntax. I installed Qt Creator 4.9.0-beta2 and it's working.

Log in to reply