这两者中更有效的手段可以提供更快的输出 第一个
outString = "My First String";
outString += "My Second String";
outString += "My Third String";
outString += "My Fourth String";
outString += "My Fifth String";
myFinalString = outString;
或第二个
outString = "My First String"
+ "My Second String"
+ "My Third String"
+ "My Fourth String"
+ "My Fifth String";
myFinalString = outString;
在其中一个屏幕中我制作的字符串超过100行,那么你会建议哪个?
答案 0 :(得分:3)
在Chrome中,性能几乎完全相同:
Firefox也显示了类似的结果,所以我不担心你使用哪种语法。