- 博客(6)
- 收藏
- 关注
原创 call和apply的作用和区别
共同点:他们的作用都是改变this的指向不同点是 :call方法可以传给该函数的参数分别作为自己的多个参数,而apply方法必须将传给该函数的参数合并成一个数组作为自己的一个参数例 function Student(name) { this.name = name this.showName = function() { console.log(this.name) } this.abc = fun
2022-02-28 22:03:02
222
原创 ES6新增的字符串方法
一、startsWith() 字符串以什么开头,返回布尔值 let str = "hello world" let result = str.startsWith("hello") console.log(result) //true二、endsWith() 判断是否以什么结尾 返回的是布尔值 let result2 = str.startsWith("world") console.log(result2)三、trim() 去除前后空格 ...
2022-02-28 21:14:30
113
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人