i have this nested array arr:
[[ "one", "two" , "three"]] I want to extract the values and join them in a var called numbers and separate them by ";"
I used this method :
var itemsArray = arr.join(";");
what i a getting is this :
one,two,three
Although what i am aiming for is one;two;three
It's reading the separator.
if the array is nested and number of levels are only two, then try
var arr = [[ "one", "two" , "three"]];
var itemsArray = arr.map( function( item ){ return item.join( ";" ) } ).join(";");
console.log( itemsArray );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With