3

I am doing an angular2 application and there I have to use StringBuilder. So I have to know How to use the string builder and how to append to it.

var sb = new StringBuilder();
var sResult = "";
$(arrayWidgets).each(function (index) {
    if (arrayWidgets[index] != "") {
        sb.append("<div class='EachWidget FL'>");
        sb.append("</div>");
    }
});

This is the code in Javascript

StringBuilder Code

var StringBuilder = function () { this.value = ""; };
StringBuilder.prototype.append = function (value) { this.value += value; };
StringBuilder.prototype.toString = function () { return this.value; };
Lucifer
  • 1,069
  • 4
  • 16
  • 26

0 Answers0