IHYPRESS PROGRAMMING
Tutorials and JavaScript programs with code and output for beginners
c programming
HOME | ASP | C | CSS | GNUPLOT | HTML | JAVASCRIPT | PERL | PHP | PYTHON | RUBY | SVG
JavaScript ❯ Enumeration Loops
<05>
<script> //for-of loop (array) document.write ("<div style='color:#990099;'>"); const cars = ["Nissan", "Volvo", "Honda", "Audi", "Toyota", "Ford", "Volkswagen"]; let output = ""; for (let tr of cars) { output += tr + " "; } document.write (output); document.write ("</div><div style='margin-top:10px;color:#0000cc;'>"); //for-in loop (object) const automobile = {make:"Volkswagen", model:"New Beetle", year:2009, color:"Sunflower Yellow"}; for (x in automobile) document.write (x + " : " + automobile[x] + "<br>"); document.write ("</div><div style='margin-top:10px;color:#cc0000;'>"); //for-in loop (array) const caribbean = ["Aruba", "Bonaire", "Curacao", "Barbados", "Martinique", "St. Kitts & Nevis", "Anguilla"]; for (country in caribbean) document.write (country + " : " + caribbean.at(country) + "<br>"); document.write ("</div><div style='margin-top:10px;color:#006600;'>"); var j = 1; do { document.write ("The number is " + j + "<br>"); ++j; } while (j < 10); document.write ("</div>"); </script>
Hergestellt in Deutschland / Made in Germany
COPYRIGHT © 2015-2024 IHY PRESS Frankfurt am Main 60329 Deutschland