Question: How can i print output like this?  

1 2 3 4  

5 6 7 8  

9 10  

i had tried this code but not luck.

```
for ($i = 1; $i<=10; $i++)
{
    if ($i <= 4)
    {
        echo $i;    
        if ($i >= 4){
            echo'<br>';
            for($x = $i; $x<=10; $x++){
                echo $x;
            }
        }
    }
}

```

this code output look like this.

1234  

45678910

Answer: 
I would use the following:

```
private _scrollListener(event){
  console.log("inside the scroll listener; this: ",this);
  this._zone.run(() => {
    this.checkForLazyLoad = !this.checkForLazyLoad;
  })
}

ngOnInit() {
  window.addEventListener("scroll", (event) => {
    this._scrollListener(event);
  });
}

```

It's because you reference the function so you lose it's execution context (i.e. the component itself). This way you will keep the `this` keyword.

Be careful with the `bind` method with TypeScript:

* <https://basarat.gitbooks.io/typescript/content/docs/tips/bind.html>
I solved this issue by simply using **arrow function** :

```
private _scrollListener(event){
    console.log("inside the scroll listener; this: ",this);
    this._zone.run(() => {
        this.checkForLazyLoad = !this.checkForLazyLoad;
    })
}

ngOnInit() {
    window.addEventListener("scroll", (event) => {
        this._scrollListener(event);
    });
}

```