import QtQuick import QtQuick.Controls import QtQuick.Layouts ApplicationWindow { width: 640 height: 480 visible: true ColumnLayout { anchors.fill: parent Component.onCompleted: { var words = [ "Hello", "World"]; function stringLengthReducer(prev, curr) { return prev + curr.length; } console.log("Array [\"Hello\", \"World\" length: " + words.reduce(stringLengthReducer, 0)); function textTextLengthReducer(prev, curr) { return prev + curr.text.length; } var childrenTextLengthSum = children.reduce(textTextLengthReducer, 0); console.log("Sum of lengths of Text children text strings: " + childrenTextLengthSum); } Text { text: "Hello" } Text { text: "World" } } }