0

I want the second part of this code work to log the object, instead of undefined

class Ball{

    whatIsThis(){ 
        console.log(this);
    }

}

var b = new Ball();

//... test 1
b.whatIsThis(); // logs the object itself

//... test 2
var method = b.whatIsThis;
method(); // logs undefined
Wolfgang Amadeus
  • 398
  • 3
  • 12

0 Answers0