JS forEach Loop
<!DOCTYPE html>
<html>
<head>
<title>JavaScript</title>
<script>
var a = ["Rahul","Karan","Aman","Neha"];
a.forEach(function(value,index) {
document.write(index + " : " + value + "<br>");
})
</script>
</head>
<body>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>JavaScript</title>
<script>
var a = ["Rahul","Karan","Aman","Neha"];
a.forEach(loop);
function loop(value, index){
document.write(index + " : " + value + "<br>");
}
</script>
</head>
<body>
</body>
</html>