摘要: 1 const num = 1000000; 2 //整数部分每三位追加一个逗号 3 num.toLocaleString(); //1,000,000 4 //转换为百分比 5 num.toLocaleString("zh", { style: "percent" }); // 100000000 阅读全文
posted @ 2022-02-07 18:19 是你吗我笑了 阅读(110) 评论(0) 推荐(0) 编辑
摘要: let arr = [1,2,[3,4,[5,6,[7,8,[9]]]]] //flat()默认拉平1层,如果不管有多少层嵌套都要拉平为一维数组,用Infinity关键字作为参数 let newArr = arr.flat(Infinity) 阅读全文
posted @ 2022-02-07 17:25 是你吗我笑了 阅读(23) 评论(0) 推荐(0) 编辑