[Development] Why is "arguments" in a QML/JS function a map and not an array?

Knoll Lars Lars.Knoll at digia.com
Wed Aug 7 21:18:09 CEST 2013


Looks like a bug. Could you please create a Jira task for it?

Thanks,
Lars

On 8/7/13 5:20 PM, "Milian Wolff" <mail at milianw.de> wrote:

>Hey there!
>
>I noticed that the magic "arguments" is a map and not an array in QML/JS
>functions. Is this intended? If so, why? If not, can it be changed or
>would 
>that break some code?
>
>See:
>
>Item {
>  function foo() {
>    console.log(JSON.stringify(arguments));
>  }
>  Component.onCompleted: {
>    foo(1, 2, 3, 4);
>  }
>}
>
>actual output:
>{"0":1,"1":2,"2":3,"3":4}
>
>expected output (which is also what "proper" javascript in a browser does:
>[1, 2, 3, 4]
>
>Bye
>-- 
>Milian Wolff
>mail at milianw.de
>http://milianw.de
>_______________________________________________
>Development mailing list
>Development at qt-project.org
>http://lists.qt-project.org/mailman/listinfo/development




More information about the Development mailing list