![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
js笔记
小鸡不要跑
这个作者很懒,什么都没留下…
展开
-
this指向
都怪大佬写的太好,让我仍不住当搬运工this永远只想最后调用他的那个对象作为一个普通函数调用 var name = "windowsName"; function a() { var name = "Cherry"; console.log(this.name); // windowsName console.log("inner:" + this); // inner: Window } a()原创 2021-09-16 11:20:01 · 71 阅读 · 0 评论 -
substr和substring
日常先看看大佬写的https://www.cnblogs.com/xxjcai/p/10865321.htmlsubstr和substring都用来截取字符串当都只有一个参数时let a = 'abcdefghijklmnopqrst' const b = a.substr(1) const c = a.substring(1) console.log(b); console.log(c);两者用法相近当两个参数时 le..原创 2021-09-09 16:25:14 · 99 阅读 · 0 评论 -
sort()笔记
arr.sort()对arr数组进行排序排序顺序可以是字母或数字,并按升序或降序。默认排序顺序为按字母升序。arr=[1,6,3,5,2,9] arr.sort() console.log(arr);arr=[1,6,3,5,2,9] arr.sort((a,b)=> b-a) console.log(arr);arr=[1,6,3,5,2,9] arr.sort((a,b)=> a-b) console.lo原创 2021-09-01 15:11:25 · 109 阅读 · 0 评论 -
split,slice,splice头晕晕
split() 方法把一个字符串分割成字符串数组。字符串=>字符串数组String.split()执行的操作与Array.join()执行的操作相反。slice()方法表示截取。slice(start,end)并不会修改数组,而是返回一个子数组原数组=>一个新的数组,包含从start 到 end(不包括该元素)的元素splice()方法向/从数组中添加/删除项目,然后返回被删除的项目splice()会改变原始数组原数组=>被删除项目的新数组...原创 2021-08-26 16:59:42 · 67 阅读 · 0 评论