生成随机图片
function getMockImagesURL() { let arr = [200, 250, 300, 350, 400, 450]; const width = arr[Math.ceil(Math.random() * 10) % 6]; const height = arr[Math.ceil(Math.random() * 10) % 6]; return 'https://picsum.photos/${width}/${height}'; }
function getMockImagesURL() { let arr = [200, 250, 300, 350, 400, 450]; const width = arr[Math.ceil(Math.random() * 10) % 6]; const height = arr[Math.ceil(Math.random() * 10) % 6]; return 'https://picsum.photos/${width}/${height}'; }
JavaScript图片延迟加载微型库Echo.js Echo.js是一个标准的独立的Javascript图片懒加载(延迟加载)库,它非常小巧快速,只有2KB,它使用HT...
1. 生成随机字符串当我们需要一个唯一id时,通过Math.random创建一个随机字符串简直不要太方便噢!!!const randomString = () ...
PHP计算:#lng为经度,lat为纬度,一定不要弄错了哦 function distance($lat1, $lng1, $lat2, $lng2){ &...
前言日常开发中,面对各种不同的需求,我们经常会用到以前开发过的一些工具函数,把这些工具函数收集起来,将大大提高我们的开发效率。1、校验数据类型export const typeOf...
1、对象的扩展运算符(...)用于取出参数对象的所有可遍历属性,拷贝到当前对象之中。let obj1 = { name:...
setTimeout 是不准的。因为 setTimeout 是一个宏任务,它的指定时间指的是:进入主线程的时间。setTimeout(callback, 进入主线程的时间)所以什么时候可以执...