How can we replicate Python's print-like behavior using console.log in JavaScript?

Combine the arrays into a string using join with \n as the delimiter.

console.log([1, 2].join(',') + '\n' + [3, 4].join(','));

Output:

1,2 3,4