Please login to start chat

ICT Solutions 13 Jun 2022, 19:52:03
Category : JavaScript Tutorials

Looping Array Element (JS Arrays)

<!DOCTYPE html>
<html>
<head>
<title>JavaScript Code Testing</title>
</head>
<body>
<p id = "demo"></p>
<script>
var cities, clen, text, i;
cities = ["Yangon", "Mandalay", "Naypyidaw", "Meikhtila"];
clen = cities.length;
text = "<ul>";
for(i=0; i<clen; i++){
text += "<li>" + cities[i] + "</li>";
}
text += "</ul>";
document.getElementById("demo").innerHTML = text;
</script>
</body>
</html>

Comments:

No comment to show.

Available Services
Download Android Application