JS高级

发布时间:2019-08-13 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了JS高级脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

一、JS正则表达式

  1. 使用正则表达是的字符串的三个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的进阶用法
  2. 正则的进阶知识

    • 字符串的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@

二、面向对象

  • 封装
  • 继承
  • 多态

三、原型链与作用域链

  1. 原型链
  2. 作用域链

四、ES5

  1. 严格模式

    • 严格模式的实现

      1. "use strict"
      2. 禁止给未声明的变量赋值
      3. 将禁默失败升级为错误
      4. 普通函数的调用中的this不在指向window,而是指向undefined
    • ES5的对象保护

      1. 单个属性保护

        • 访问器属性
        • 数据属性
      2. 对象结构的保护

        • 扩展
        • 密封
        • 解冻
      3. 属性的分类

        • 命名属性
        • 数据属性
        • 访问器属性
        • 内部属性
        • class属性
      4. 替换this的三种方式

  2. 数组API:

  3. 列表里引用:

五、ES6

  1. 列表项目

六、未完待续

七、闭包

脚本宝典总结

以上是脚本宝典为你收集整理的JS高级全部内容,希望文章能够帮你解决JS高级所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。