Join items in the array

Contents

Output

a,b,c


Code examples


JavaScript

array = ['a', 'b', 'c'];
console.log(array.join(","));

Perl

my @array = ("a", "b", "c");
print join(",", @array)."\n";

PHP

<?php
$array = ["a", "b", "c"];
print(implode(",", $array)."\n");

Python

array = ["a", "b", "c"]
print(",".join(array))

Ruby

array = ['a', 'b', 'c']
print(array.join(',') + "\n")