随笔分类 -  ECMAScript

摘要:【ECMAScript】ajax请求 普通表单,默认会带上cookie $.ajax({ url: '/test/getUserInfo', method: 'POST', data: {'token': token}, success: function(response) { console.l 阅读全文
posted @ 2024-10-24 17:57 翠微 编辑
摘要:function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }, function shuffleArray(array) { for (let i = array.length - 1; i > 0; i 阅读全文
posted @ 2024-05-11 16:17 翠微 编辑
摘要:Base64 转码btoa():任意值转为 Base64 编码atob():Base64 编码转为原来的值 function b64Encode(str) { return btoa(encodeURIComponent(str)); } function b64Decode(str) { retu 阅读全文
posted @ 2024-01-10 16:24 翠微 编辑
摘要:1、替换IP str.replace(/http[s]?:\/\/.*\.[0-9]{1,4}(:[\w]+)?/g,'') 阅读全文
posted @ 2022-11-23 13:08 翠微 编辑
摘要:【ECMAScript】常用判断整理 1、判断是否 undefined 2、判断对象是否有函数 fn 对象 obj 1、判断是否undefined if (typeof(obj) 'undefined') { } 2、判断对象是否有函数 fn function hasFunction(fn) { i 阅读全文
posted @ 2022-08-03 13:46 翠微 编辑
摘要:Object.keys Object.defineProperty(p, 'age', { value: 18, enumerable: false }) 阅读全文
posted @ 2022-04-29 21:59 翠微 编辑
摘要:for of for (let [index, item] of arr.entries()) { } for (const [index, item] of arr.entries()) { } 阅读全文
posted @ 2022-03-24 14:30 翠微 编辑
摘要:http://momentjs.cn/ npm install moment --save # npm yarn add moment # Yarn Install-Package Moment.js # NuGet spm install moment --save # spm meteor ad 阅读全文
posted @ 2022-02-17 14:25 翠微 编辑
摘要:函数声明: function foo() {},函数声明会被引擎提升匿名函数:function () {}; 函数表达式:var fun = function () {}; 要在函数体后面加括号就能立即调用,则这个函数必须是函数表达式,不能是函数声明 foo();// 因为函数声明提升,不会报错 f 阅读全文
posted @ 2021-10-22 15:02 翠微 编辑
摘要:【使用学习】常用正则表达式 1、域名和IP 2、手机号码 3、邮箱 4、邮政编码 5、英文 6、中文 7、版本号 8、联系电话 9、传真 1、域名和IP 域名中的标号都由英文字母和数字组成,每一个标号不超过63个字符,也不区分大小写字母。标号中除连字符(-)外不能使用其他的标点符号。级别最低的域名写 阅读全文
posted @ 2019-10-23 14:39 翠微 编辑

点击右上角即可分享
微信分享提示