![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
前端_JS类
js类
BePowerful
这个作者很懒,什么都没留下…
展开
-
使用可配置请求头的方式进行a标签文件下载
xhr.open('GET', 'https://api.bentley.com/designelementclassification/runs/a464f67a-62b3-491d-b797-63528f655d61/results/predictions.zip', true); xhr.setRequestHeader("Authorization", accessToken); xhr.responseType = 'blob'; xhr.onlo...原创 2022-05-18 17:40:45 · 789 阅读 · 0 评论 -
正则表达式中 exec 和 match
// test 1var str = '1a2b3c4d5e'; //准备一个字符串var reg = /\d(\w)\d/; //正则:匹配以数字开头,中间是字母,以数字结尾console.log(reg.exec(str));console.log(reg.exec(str));// test 2var str = '1a2b3c4d5e'; //准备一个字符串var reg = /\d(\w)\d/g; //正则:匹配以数字开头,中间是字母,以数字结尾console.log..原创 2021-04-16 11:01:22 · 120 阅读 · 0 评论 -
javascript中 new String 和 String的区别
当 String() 和运算符 new 一起作为构造函数使用时,它返回一个新创建的 String 对象,存放的是字符串s或s的字符串表示。当不用 new 运算符调用 String() 时,它只把s转换成原始的字符串,并返回转换后的值。var s0 = 'hello';var s1 = new String(s0);var s2 = String(s0);console.log(s1 === s2); // falseconsole.log(s1 === s0); // false...原创 2021-04-16 10:59:49 · 553 阅读 · 0 评论 -
null 和 undefined 区别,应用场景
undefined ,表示未定义,没有找到 应用场景 // 1.变量被声明时,但没有复制时,就等于undefinedvar a;console.log(a); //输出结果为:undefined// 2.函数调用时,应该提供的参数没有提供,该参数等于undefinedfunction f(a,b) { console.log(a,b)}f("你好"); //输出结果为:你好 undefined// 3.对象没有赋值的属性,该属性的值为undefinedvar ob..原创 2021-04-16 10:55:43 · 360 阅读 · 0 评论