Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript add string inside foreach

var fruits = [1, 2, 3];
fruits.forEach(myFunction);

function myFunction(item, index) {
  document.getElementById("demo").innerHTML += index + ":" + item + "<br>"; 
}
 
PREVIOUS NEXT
Tagged: #javascript #add #string #foreach
ADD COMMENT
Topic
Name
8+1 =