Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ES6 #38

Open
L-small opened this issue May 12, 2020 · 0 comments
Open

ES6 #38

L-small opened this issue May 12, 2020 · 0 comments

Comments

@L-small
Copy link
Owner

L-small commented May 12, 2020

Symbol

内置属性:

  • hasInstance方法 instanceof时调用此方法
class MyClass {
  [Symbol.hasInstance](foo) {
    return false;
  }
}

[1, 2, 3] instanceof new MyClass() // false
  • isConcatSpreadable 控制concat是否展开,默认undefined。为true和undefined可以展开
let arr2 = ['c', 'd'];
arr2[Symbol.isConcatSpreadable] = false;
['a', 'b'].concat(arr2, 'e') // ['a', 'b', ['c','d'], 'e']

箭头函数

  • 没有this,需要通过查找上层作用域链来确定 this 的值
  • 没有arguments对象,被非箭头函数包裹时箭头函数内部调用arguments是非箭头函数的
  • 不能通过new关键字调用
  • 没有new.target
  • 没有原型
  • 没有super
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant