Say i have a javascript class with a method, foo(). In another method, f.e componentDidMount, i want to access method foo() inside an iffe. How do i bind the 'this' context to be available inside the iffe? 

I know i can this = self and use that, or use arrow syntax, but i would like to expand my knowledge of js & this, and thus do it with a proper binding. I've tried:

```
(function doSomething() {
  this.foo();
}.bind(this)())

```

But that doesn't work. Example code:

```
class Test extends React.Component {
  constructor(props) {}

  public componentDidMount() {
    (function doSomething() {
      this.foo();
    })();
  }

  foo() {
    // ...
  }
}

```