Is there a way to pass an unknown number of arguments like:
var print_names = function(names) { foreach(name in names) console.log(name); // something li
You can create a function using the spread/rest operator and from there on, you achieved your goal. Please take a look at the chunk below.
const print_names = (...args) => args.forEach(x => console.log(x));