logo
  • 教程列表
  • SO官方文档
  • 箭头函数
    • 箭头函数介绍
    • 词汇范围绑定(价值)
    • 参数对象
    • 隐式返回
    • 箭头用作构造函数
    • 显式返回
  1. StackOverflow 文档
  2. JavaScript 教程
  3. 箭头函数
  4. 箭头用作构造函数

箭头用作构造函数

Created: November-22, 2018

当与 new 关键字一起使用时,箭头函数将抛出 TypeError。

const foo = function () {
  return 'foo';
}

const a = new foo();

const bar = () => {
  return 'bar';
}

const b = new bar(); // -> Uncaught TypeError: bar is not a constructor...
  • 显式返回
  • 隐式返回

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 关于我们
  • 免责声明