随笔分类 -  JavaScript

摘要:1.ES6 Set去重(ES6中最常用) Set 对象允许你存储任何类型的唯一值,无论是原始值或者是对象引用 Set对象是值的集合,你可以按照插入的顺序迭代它的元素。 Set中的元素只会出现一次,即 Set 中的元素是唯一的。 let set = new Set([1, 2, 3, 4, 4]) c 阅读全文
posted @ 2021-05-27 18:54 秦笑 阅读(138) 评论(0) 推荐(0)
摘要:call()、apply()、bind() 创建一个新函数,当这个新函数被调用时,它的 this 值是传递给第一个参数; call() 和 apply() 之间的区别 不同之处是: call() 方法分别接受参数。 apply() 方法接受数组形式的参数。 如果要使用数组而不是参数列表,则 appl 阅读全文
posted @ 2021-05-19 18:31 秦笑 阅读(46) 评论(0) 推荐(0)
摘要:HTTPS页面里动态的引入HTTP资源 , .在HTTPS页面里通过AJAX的方式请求HTTP资源,报错 在head中加入 <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"> 意思是自动将ht 阅读全文
posted @ 2021-05-11 15:00 秦笑 阅读(541) 评论(0) 推荐(0)
摘要:以 angular 为例: 安装videojs npm install video.js --save npm install videojs-flash --save 在 angular.json 中引入 "styles": [ "src/styles.less", "node_modules/v 阅读全文
posted @ 2020-12-29 16:49 秦笑 阅读(4630) 评论(0) 推荐(0)
摘要:declare const window: Window & { WeixinJSBridge: any, WVJBCallbacks: any }; declare const window: Window & { WeixinJSBridge: any, WVJBCallbacks: any } 阅读全文
posted @ 2020-11-17 10:51 秦笑 阅读(5153) 评论(0) 推荐(0)
摘要:接口: https://v0.yiketianqi.com/api?version=v61&appid=97859956&appsecret=Jjoc7T35 官网: https://www.tianqiapi.com/文档:https://www.tianqiapi.com/index/doc?v 阅读全文
posted @ 2020-10-16 14:45 秦笑 阅读(801) 评论(0) 推荐(0)
摘要:参考 http://www.ruanyifeng.com/blog/2015/05/async.html https://segmentfault.com/a/1190000007535316 await 只能出现在 async 函数中 async 函数返回的是一个 Promise 对象。 asyn 阅读全文
posted @ 2020-06-02 10:48 秦笑 阅读(172) 评论(0) 推荐(0)
摘要:function addOne(a) { return a + 1; }; function multiTwo (a) { return a*2; } function divThree (a) { return a/3; } function toString (a) { return a + ' 阅读全文
posted @ 2020-04-17 21:13 秦笑 阅读(567) 评论(0) 推荐(0)
摘要:sort() sort() 方法以字母顺序对数组进行排序: var arr= ["Banana", "Orange", "Apple", "Mango"]; arr.sort(); // arr = [ "Apple","Banana","Mango","Orange"] var arr= ["1" 阅读全文
posted @ 2019-12-13 12:02 秦笑 阅读(103) 评论(0) 推荐(0)
摘要:表达式 /^[0-9]+abc$/ // 以数字开始 abc字符串结束 123abc// + 表示前面的字符必须至少出现一次 var patt=/^[0-9]+abc$/;var result=patt.test('abc'); // false /^[0-9]*abc$/ // 以数字开始 abc 阅读全文
posted @ 2019-12-07 11:43 秦笑 阅读(215) 评论(0) 推荐(0)
摘要:push() push() 方法可向数组的末尾添加一个或多个元素,并返回新的长度。 var arr = ['a','b','c','d'] arr.push("e") // a,b,c,d,e arr.push("e", "f") // a,b,c,d,e,f pop() pop() 方法用于删除并 阅读全文
posted @ 2019-12-07 11:41 秦笑 阅读(713) 评论(0) 推荐(0)
摘要:join() join() 方法用于把数组中的所有元素放入一个字符串。 元素是通过指定的分隔符进行分隔的。 arrayObject.join(separator), 默认为使用逗号分隔 var arr = ['a','b','c','d','e','f']; arr.join() // a,b,c, 阅读全文
posted @ 2019-12-06 16:09 秦笑 阅读(1559) 评论(0) 推荐(0)
摘要:substr() 方法 substr() 方法可在字符串中抽取从 start 下标开始的指定数目的字符。 stringObject.substr(start,length) start:必需。要抽取的子串的起始下标。必须是数值。如果是负数,那么该参数声明从字符串的尾部开始算起的位置。 也就是说,-1 阅读全文
posted @ 2019-12-06 15:51 秦笑 阅读(3131) 评论(0) 推荐(0)
摘要:原文链接:https://blog.csdn.net/usuallyuser/article/details/83060341 accept="application/msexcel,application/msword,application/pdf" <input type="file" acc 阅读全文
posted @ 2019-12-03 16:17 秦笑 阅读(1838) 评论(0) 推荐(0)
摘要:find(); find() 方法返回通过测试(函数内判断)的数组的第一个元素的值。 find() 方法为数组中的每个元素都调用一次函数执行: 当数组中的元素在测试条件时返回 true 时, find() 返回符合条件的元素,之后的值不会再调用执行函数。 如果没有符合条件的元素返回 undefine 阅读全文
posted @ 2019-11-29 10:15 秦笑 阅读(8251) 评论(0) 推荐(0)