Q:

Append fragments to string

what I am trying:
args = ["4730/2", "17583/4"];

for (var i = 0; i < args.length; i++) {
    console.log('here');
    url = args[i] + "/";
};

console.log(url);

I need to concatenate a string to generate something like this:
4730/2/17583/4/4730/2/17583/4

How can I do that?
http://jsfiddle.net/5npet/

A:

If you already have the strings well formed in an array, you can simply join them using the separator you want:
var args = ["4730/2", "17583/4"];

var url = args.join('/');

console.log(url); // "4730/2/17583/4"

The error in your approach is that you overwrite the url variable at each iteration. Instead you should append the next part of the string like so:
var url = '';
for (var i = 0; i < args.length; i++) {
    url += args[i] + "/";
};

After that, you still need to eliminate the last slash:
url = url.slice(0, str.length-1);

