Test (). A ('Ilemm A.'). B ('IlemmB')

for example, if you want to use test (). A ("Isimm A."). B ("Ilemm B"), output how test an I"m A b I"m B should define test?.

Mar.09,2021

function test () {
  return {
    callInfo: 'test',
    a (arg) {
      this.callInfo += ' ' + arguments.callee.name + ' ' + arg
      return this
    },
    b (arg) {
      return (this.callInfo += ' ' + arguments.callee.name + ' ' + arg)
    }
  }
}
test().a('I\'m A.').b('I\'m B')


   function test() {
        function a(){
            console.log(" a I'm A ")
            return this
        }
        function b(){
            console.log("b I'm B")
            return this
        }
        console.log('test')
        return {
            a: a,
            b: b
        }
    }
    test().a().b()

jquery is the big brother in this respect, you can refer to the source code, but this is enough for you to use
downstairs answer is the correct solution.

Menu