flatten()

功能

数组扁平化一个层次。

语法

langx.flatten(array)

参数

  • array
    需扁平的数组

范例

Example: flatten([1,2,[3,4],5]),b 显示结果。

<!DOCTYPE html>
<html>

<head>
    <style>
    </style>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.3/require.min.js"></script>
    <script>
    require.config({
        baseUrl: "./",
        packages: [{
            name: "skylark",
            location: "../../../src/skylark"
        }, ]
    });
    </script>
</head>

<body>
   flatten([1,2,[3,4],5]) . result <b></b>
    <script>
    require(["skylark/finder", "skylark/langx", "skylark/datax"], function(finder, langx, datax) {
        datax.text(finder.find("b"), langx.flatten([1,2,[3,4],5]));
    });
    </script>
</body>

</html>