Question: I have a code like this:

```js
var students = [
          {
            name: 'Mustafa',
            track: 'A',
            achievements: 5,
            points: 500
          },
          {
            name: 'Ersin',
            track: 'B',
            achievements: 6,
            points: 600
          },
          {
            name: 'Ahmet',
            track: 'C',
            achievements: 7,
            points: 700
          },
          {
            name: 'Mehmet',
            track: 'D',
            achievements: 8,
            points: 800
          },
          {
            name: 'Cafer',
            track: 'E',
            achievements: 9,
            points: 900
          }
        ];

        var HTML;
        var s = 0;

        function print(message) { 

          var outputDiv = document.getElementById('output'); 

          outputDiv.innerHTML = message; 

        } 

        for (var s = 0; s < students.length; s += 1) {
          HTML += '<h2>' + 'Student: ' + students[s].name + '</h2>' ;
          HTML += '<p>' + 'Track: ' + students[s].track + '</p>';
          HTML += '<p>' + 'Points: ' + students[s].points + '</p>';
          HTML += '<p>' + 'Achievements: ' + students[s].achievements + '</p>';

        };

        print(HTML);
```

```html
<div id="output"></div>
```

Unfortunately, only bad-outcome for this code is an "undefined" at the beginning. I would like to get rid of this.

Is it something about my loop or any other detail that i couldn't predict?

Answer: 
Initialize `HTML` to "", you are getting `undefined` since `HTML` (since it is not initialized) is `undefined`

```
var HTML = ""; //change this line

```

**Demo**

```js
var students = [
      {
        name: 'Mustafa',
        track: 'A',
        achievements: 5,
        points: 500
      },
      {
        name: 'Ersin',
        track: 'B',
        achievements: 6,
        points: 600
      },
      {
        name: 'Ahmet',
        track: 'C',
        achievements: 7,
        points: 700
      },
      {
        name: 'Mehmet',
        track: 'D',
        achievements: 8,
        points: 800
      },
      {
        name: 'Cafer',
        track: 'E',
        achievements: 9,
        points: 900
      }
    ];

    var HTML = ""; //change this line
    var s = 0;

    function print(message) { 

      var outputDiv = document.getElementById('output'); 

      outputDiv.innerHTML = message; 

    } 

    for (var s = 0; s < students.length; s += 1) {
      HTML += '<h2>' + 'Student: ' + students[s].name + '</h2>' ;
      HTML += '<p>' + 'Track: ' + students[s].track + '</p>';
      HTML += '<p>' + 'Points: ' + students[s].points + '</p>';
      HTML += '<p>' + 'Achievements: ' + students[s].achievements + '</p>';

    };

    print(HTML); 
```

```html
<div id="output"></div>
```
Initialize HTML variable with an empty string like this:

```
var HTML="";

```