concat1.js 831 B

123456789101112131415161718192021222324252627282930313233
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. WScript.Echo("Basic string concatenation.");
  6. var n = 5;
  7. var x = new Array(n);
  8. var count = 1;
  9. for(var i = 0; i < n; ++i)
  10. {
  11. var c = String.fromCharCode(97+i);
  12. x[i] = "";
  13. for(var j = 0; j < count; ++j)
  14. {
  15. x[i] += c;
  16. }
  17. count *= 3;
  18. }
  19. var str = x[0];
  20. str += x[1] + x[2];
  21. str += "XXXX";
  22. str += x[3] + "XXXX";
  23. str += str + x[4] + str + x[4];
  24. str += str + x[0] + str;
  25. str += "XXXX";
  26. WScript.Echo(str);