【发布时间】:2023-04-05 13:48:01
【问题描述】:
我在一个数组中有几个字符串。
例如:
[
"path/to/file",
"path",
"path/to/",
"path2/to/file",
"path2/to/file",
"path2/to"
]
等等……
我想要实现的是根据斜线的计数对数组进行排序。所以较少的计数斜线在顶部。
所以它会是这样的:
[
"path",
"path/to/",
"path2/to",
"path/to/file",
"path2/to/file",
"path2/to/file"
]
【问题讨论】:
标签: javascript sorting