Answers for "javascript x number of parameters"

1

javascript x number of parameters

function display_numbers(...numbers) {
	colors.forEach(function(x) {
  		console.log(x);
	});
}

// call it like:
display_numbers(1)
display_numbers(1, 2, 3, 4)
display_numbers(1, -1, 9, 0, 2)
Posted by: Guest on June-30-2020
0

Pass unknown number of arguments into javascript function

var print_names = function(...names) {
    for (let i=0; i<names.length; i++) console.log(names[i]);
}
Posted by: Guest on April-05-2020

Code answers related to "javascript x number of parameters"

Code answers related to "Javascript"

Browse Popular Code Answers by Language