Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js foreach

var stringArray = ["first", "second"];

myArray.forEach((string, index) => {
  	var msg = "The string: " + string + " is in index of " + index; 
	console.log(msg);
	
	// Output:
	// The string: first is in index of 0
	// The string: second is in index of 1
});
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #js #foreach
ADD COMMENT
Topic
Name
1+5 =