Append a sequence of numbers after each word in a string
<p>I have a function that needs to append a sequence of numbers (starting with 1) at the end of each word in the string. Here is my function:</p>

<pre><code>function insertNum(str) {
    var word = new Array();
    word = str.split(" ");
    return src[0] + "1 " + src[1] + "2 " + src[2] + "3 " + src[3];
}

insertNum("word word word word."); // return "word1 word2 word3 word4."
insertNum("word word word."); // return "word1 word2 word3."
</code></pre>
