cxyct2 最近的时间轴更新
cxyct2

cxyct2

V2EX 第 421554 号会员,加入于 2019-06-13 23:16:06 +08:00
cxyct2 最近回复了
大家别笑我了,😄
@darksword21 orz 好吧,抱歉了,写了一大堆没有换行
@darksword21 喜欢前端
class A {
      constructor (props) {
        this.props = props
        this.printProps = this.printProps
      }
      printProps = function () {
        return this.props
      }
    }
    (function () {
      const a = new A('haha')
      console.log(a.printProps())
      const fun = a.printProps
      console.log(fun())
    })();
如果不绑 this 的话 a.printProps()不会报错,但是 fun()会报错
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3106 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 13ms · UTC 14:33 · PVG 22:33 · LAX 07:33 · JFK 10:33
Developed with CodeLauncher
♥ Do have faith in what you're doing.