摘要: 随机数 Math.random() 0~1 随机小数 [ 0,1 ) 公式: 在min到max之间取一个随机整数 parseInt( Math.random() * (max - min + 1) + min ) 简写: 在0~max之间取一个随机整数 parseInt( Math.random() 阅读全文
posted @ 2020-01-10 15:18 蓝空之忆 阅读(95) 评论(0) 推荐(0) 编辑
摘要: function test(){ console.log(arguments); // 类数组 // 类数组转化为数组 console.log(Array.prototype.slice.call(arguments)); } test(1,2,3,4,5); function test(){ co 阅读全文
posted @ 2019-09-29 12:01 蓝空之忆 阅读(301) 评论(0) 推荐(0) 编辑
摘要: Object.prototype.num = 1; // 原型链顶端 var person1 = { name: 'ytao', age: 18, sex: 'male', height: 165, weight: 100, children: { first:{ name: '张小一', age: 阅读全文
posted @ 2019-09-28 13:43 蓝空之忆 阅读(173) 评论(0) 推荐(0) 编辑
摘要: /** 判断变量类型 * @param {params}: 变量/参数 * @return string | Object | number | boolean | Null | undefined | function | Array */ function getType(params) { l 阅读全文
posted @ 2019-09-03 15:19 蓝空之忆 阅读(173) 评论(0) 推荐(0) 编辑
摘要: console.log ("console.log : 输出普通信息"); console.warn ("console.warn : 输出警告信息"); console.info ("console.info : 输出提示信息"); console.error ("console.error: 输 阅读全文
posted @ 2019-09-03 11:06 蓝空之忆 阅读(198) 评论(0) 推荐(0) 编辑
摘要: // 获取url相应的参数 function getParams(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); var r = window.location.search.substr(1).match(r 阅读全文
posted @ 2019-09-03 11:05 蓝空之忆 阅读(268) 评论(0) 推荐(0) 编辑