lodash 内zip方法的使用问题

发布于 2022-09-11 22:06:13 字数 609 浏览 13 评论 0

[ [ 1, 34.02 ],
[ 2, 34.7 ],
[ 3, 33.5 ],
[ 4, 34.02 ],
[ 5, 33.51 ],
[ 6, 34.54 ],
[ 7, 34.54 ],
[ 8, 34.7 ],
[ 9, 34.91 ],
[ 10, 34.02 ],
[ 11, 34.02 ],
[ 12, 34 ],
[ 13, 34.7 ],
[ 14, 34.02 ],
[ 15, 34.91 ],
[ 16, 34.7 ],
[ 17, 34.54 ],
[ 18, 35.04 ],
[ 19, 35 ],
[ 20, 34.22 ],
[ 21, 34.7 ],
[ 22, 34.5 ],
[ 23, 34.7 ],
[ 24, 34.54 ],
[ 25, 35.42 ],
[ 26, 35.42 ],
[ 27, 35.42 ],
[ 28, 35.2 ],
[ 29, 35.42 ],
[ 30, 34.54 ] ]
以上这个数组如何使用lodash 的 zip方法?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

二货你真萌 2022-09-18 22:06:13
const arr = [ [ 1, 34.02 ],
[ 2, 34.7 ],
[ 3, 33.5 ],
[ 4, 34.02 ],
[ 5, 33.51 ],
[ 6, 34.54 ],
[ 7, 34.54 ],
[ 8, 34.7 ],
[ 9, 34.91 ],
[ 10, 34.02 ],
[ 11, 34.02 ],
[ 12, 34 ],
[ 13, 34.7 ],
[ 14, 34.02 ],
[ 15, 34.91 ],
[ 16, 34.7 ],
[ 17, 34.54 ],
[ 18, 35.04 ],
[ 19, 35 ],
[ 20, 34.22 ],
[ 21, 34.7 ],
[ 22, 34.5 ],
[ 23, 34.7 ],
[ 24, 34.54 ],
[ 25, 35.42 ],
[ 26, 35.42 ],
[ 27, 35.42 ],
[ 28, 35.2 ],
[ 29, 35.42 ],
[ 30, 34.54 ] ]
_.zip(...arr)
// => [[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],[34.02,34.7,33.5,34.02,33.51,34.54,34.54,34.7,34.91,34.02,34.02,34,34.7,34.02,34.91,34.7,34.54,35.04,35,34.22,34.7,34.5,34.7,34.54,35.42,35.42,35.42,35.2,35.42,34.54]]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文