随笔分类 - Javascript
摘要:// toD.js文件export default (val) => { const e = String(val) let rex = /^([0-9])\.?([0-9]*)e-([0-9])/ if (!rex.test(e)) return val const numArr = e.matc
阅读全文
摘要:// tofix.js文件// params// val: 要处理的数据,Number | String// len: 保留小数位数,位数不足时,以0填充// side: 1|-1 对应 入|舍export default (val, len, side) => { const numval = N
阅读全文
摘要:let arr = ['g', 'b', 'c', 'd', 'e', 'a', 'g', 'b', 'c'];// 数组随机排序(原数组被修改)Array.prototype.randomSort = function () { const len = this.length; for (let
阅读全文
摘要:let arr = [{a:1},{a:2},{a:3},{a:4},{a:5}]; // 1.while循环 let sum = 0; let num = 1; while(num <= 1){ if (num 5) { num++; continue // containue必须写在++后面,否
阅读全文

浙公网安备 33010602011771号