脚本宝典收集整理的这篇文章主要介绍了JS高级,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
一、JS正则表达式
-
使用正则表达是的字符串的三个API
//(1)replace基础用法
VAR str = "welcome to my home"
str = str.replace(/m/g,'x')
console.LOG(str)//welcoxe to xy hoxe
//(2)replace进阶用法
var str = "welcome to my home"
str = str.replace(/b(w)|s(w)/g,(val)=>{
console.log(val)
})
//(1)seArch的用法
var str = "hello world"
c = str.search('h')
console.log(c)//0
//(2)支持正则的用法
c = str.search(/o/g)
console.log(c)//4
//(1)match的正则用法
var str = "who am i,i don't konw"
arr = str.match(/k[w]+w/g)
console.log(arr)//['konw']
//(2)match的普通用法
var str = "tom is a good boy"
lon = str.match('tom')
console.log(lon)//[ 'tom', index: 0, input: 'tom is a good boy' ]
//如果匹配不到值返回null
//(3)match的进阶用法
-
正则的进阶知识
- 字符串的API
-
普通用法
var str = "hello"
arr = str.split('')
console.log(arr)//['h','e','l','l','o']
-
正则用法
var str = "hello world"
arr = str.split(/s/g)
console.log(arr)
@H_406_201@
二、面向对象
- 封装
- 继承
- 多态
三、原型链与作用域链
- 原型链
- 作用域链
四、ES5
五、ES6
- 列表项目
六、未完待续
七、闭包
以上是脚本宝典为你收集整理的JS高级全部内容,希望文章能够帮你解决JS高级所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。