Search code examples
javascripthtmlmeteorline-breaks

Return Variable with break


I create a code which gives me back a variable. At the moment the variable gives back the values like value1, value2, ... in one line. But I need this with breaks Value1 Value2 ...

Here is my code

while (test[i]) {
          var total = 0;
          var spielerName = '';

          Spieltag.find({SpielerID: test[i]}).map(function(doc) {
             total += doc.Note;
          });
          Playerslist.find({SpielerID: test[i]}).map(function(doc) {
             spielerName += doc.Name;
          });

          spielerPkt += spielerName + ": " + total + ", ";
          i++;
        }
        return spielerPkt;

In html this is simple in the body with {{TemplateFunction}} Can I make an adjustment in html to get my needs or must I change my while loop?


Solution

  • You can insert a line break by adding \n to the string.