how to print a array js

JavaScript
var array = [1,2,3]

for(var i = 0; i < array.length ; i++){
    console.log(array[i])
}var fruits = ["Banana", "Orange", "Apple", "Mango"];
var x = fruits.toString();const arr = [1, 2, 'a', '1a'];
const str = arr.toString();
console.log(str); //> "1,2,a,1a"
Source

Also in JavaScript: