Loading ...
Sorry, an error occurred while loading the content.

138Concatenate strings and pass Jslint

Expand Messages
  • osteocosmosis
    Aug 2, 2008
      To concatenate strings I use:

      // Concatenation of string 'str', n times.
      function repeatstr (n, str) {
      var an = new Array(1 + n);
      return an.join(str);
      }

      ------------

      This avoids repeated memory allocations that you get from +=, but
      jslint complains about the 'new Array(1 + n);'

      So what should I use to concatenate strings?
    • Show all 2 messages in this topic