Loop through an array and pass its own values in as a parameter in an anonymous function

First the array arrayNames gets declared and assigned two values. Then the array get looped through using the map function and each time it loops the value will be passed into the parameter “name”. Inside the function there is a simply console log which will display first “Hi there, John doe” and then “Hi There, Jane Doe” in the console.

var arrayNames = [ "John Doe", "Jane Doe"];
	console.log("Hi There, " + name);

Add your comment