I want to print elements of the array separated by commas in JavaScript How shall I do it?
javascript jquery
Try using Array.prototype.join().
var arr = new Array(3);
arr[0] = "Zero";
arr[1] = "One";
arr[2] = "Two";
document.write(arr.join(", "));
Like this.
© 2024 OneMinuteCode. All rights reserved.