Search code examples
javascriptstringperformanceconcatenationjsperf

Prepend text to beginning of string


What is the fastest method, to add a new value at the beginning of a string?


Solution

  • var mystr = "Doe";
    mystr = "John " + mystr;
    

    Wouldn't this work for you?