ينجز:
وظيفة stringBuffer () {this .__ strings__ = [] ؛ } ؛ stringBuffer.Prototype.append = function (str) {this .__ strings __. push (str) ؛ إرجاع هذا ؛ } ؛ // تنسيق سلسلة stringbuffer.prototype.appendformat = function (str) {for (var i = 1 ؛ i <enduces.length ؛ i ++) {var parent = "// {" + (i - 1) + "//}" ؛ var reg = new regexp (parent ، "g") str = str.replace (reg ، mations [i]) ؛ } هذا .__ سلاسل __. الدفع (str) ؛ إرجاع هذا ؛ } stringBuffer.Prototype.ToString = function () {return this .__ __trings __. Join ('') ؛ } ؛ StringBuffer.Prototype.clear = function () {this .__ strings__ = [] ؛ } stringbuffer.prototype.size = function () {return this .__ Strings __. length ؛ }المكالمات التي تم إنشاقها
var sbhtml = new StringBuffer () ؛ sbhtml.append ('hello') ؛ sbhtml.append ('World') ؛ console.log (sbhtml.toString ()) ؛المثال البسيط أعلاه لتنفيذ JS هو كل المحتوى الذي أشاركه معك. آمل أن تتمكن من إعطائك مرجعًا وآمل أن تتمكن من دعم wulin.com أكثر.