js分号踩坑记录

1.缺少分号导致的报错

在test()后面加上一个分号就能正常打印

const person = {
  name: "person",
  a: function () {
    console.log(this)
  }
}

function test() {
  (person.a)()
}               

person.a()      //person对象
test()          //person对象
(person.a)()    //Uncaught TypeError: test(...) is not a function    ?
原文地址:https://www.cnblogs.com/lilisblog/p/13840094.html