forEach Loop Array tutorial in JavaScript

 <!DOCTYPE html>

<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>forEach Loop Array JavaScript</title>
    <script>
        var a = ["Rahul", "Karan", "Aman", "Neha"];
        var fruits = ["Apple", "Banana", "Pineapple", "Grapes", "coconut", "orange"];

        a.forEach(function (value, index) {
            document.write(index + " : " + value + "<br><br>");
        });

        document.write("<br><br><br><br>");
        fruits.forEach(DataContainer);
        function DataContainer(value, index) {
            document.write(index + " : " + value + "<br><br>");
        }
    </script>
</head>

<body>
</body>

</html>




Comments

Popular posts from this blog

Symbols tutorial in Advance JavaScript

Async and Await Method tutorial in Advance JavaScript

String Methods in JavaScript