The most viewed posts

Registry Reviver

How to clean up Windows Computer

About Desktop Icons in Windows Computer

Web Development Services

How to make a computer secure and run faster

Driver Booster

Myanmar font and keyboard for Windows

CCleaner

Advanced System Care

some (JavaScript Array Method)

The most viewed items

Desktop Hard Disk

Dell Inspiron 5559

HP ProBook 430

SONY Playstation Portable

Laptop RAM

External Hard Disk

Laptop

ZilaStar ICT Jun 05 2022, 10:20:42
Category : JavaScript Tutorials

Foreach() (JS Array Iteration)

<!DOCTYPE html>
<html>
<head>
<title>JavaScript Code Testing</title>
</head>
<body>
<p id = "demo"></p>
<script>
var txt = "";
var numbers = [302, 428, 49, 92, 84, 70, 80, 10, 3, 200];
var num = numbers.sort(function (a, b){return a - b;});

txt = "<ol>";
num.forEach(jsFunction);

document.getElementById("demo").innerHTML = txt;

function jsFunction(value){
txt += "<li>" + value + "</li><br/><hr/><br/>";
}

txt += "</ol>";

</script>
</body>
</html>

  • Comments:

    No comment to show.

    To Contact
    Available Services
    Terms and Conditions