7-4 修订Function.prototype.toString()

26 阅读1分钟

修订Function.prototype.toString() 返回源代码中的实际文本片段

// toString()

function foo(){
  // 这是ES10
  console.log('cc')
}
foo.toString()

之前调用 toString的时候只返回函数的主体,ES10修订完之后不仅返回函数的主题还返回注释空格