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

Milian Wolff mail at milianw.de
Wed Aug 7 17:20:37 CEST 2013


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



More information about the Development mailing list