Iva*_*loi 2 javascript arrow-functions
嘿,我一直在尝试从数组中返回 2 个最小的数字,无论索引如何。你能帮我一下吗?
kin*_*ser 5
Array#slice
var arr = [5, 4, 7, 2, 10, 1], res = arr.sort((a,b) => a - b).slice(0, 2); console.log(res);
归档时间:
8 年,7 月 前
查看次数:
8151 次
最近记录:
7 年 前