Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q518 How can I join all the keys values in a hash array?

You are here: irt.org | FAQ | JavaScript | Object | Q518 [ previous next ]

Try this:

<script language="JavaScript"><!--

a = new Array();

a['test1'] = 'test 1 value';
a['test2'] = 'test 2 value';
a['test3'] = 'test 3 value';
a['test4'] = 'test 4 value';
a['test5'] = 'test 5 value';

function joinHash(what,separator) {
    var output = '';

    for (var i in a)
        output += a[i] + separator;

    return output.substring(0,output.length-1);
}

alert(joinHash(a,'/'));
//--></script>

Feedback on 'Q518 How can I join all the keys values in a hash array?'

©2018 Martin Webb