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 ❯ Array Properties and Methods
<15>
<script> const colours = ["red", "green", "blue", "yellow", "magenta", "cyan", "white", "black"]; document.write ("<p>Original: " + colours + "</p>"); colours.sort(); document.write ("<p>sort: " + colours + "</p>"); colours.reverse(); document.write ("<p> reverse: " + colours + "</p>"); colours.push("Orange"); document.write ("<p>push: " + colours + "</p>"); colours.unshift("Purple"); document.write ("<p>unshift: " + colours + "</p>"); colours.pop(); document.write ("<p>pop: " + colours + "</p>"); colours.shift(); document.write ("<p>shift: " + colours + "</p>"); colour_names = colours.toString(); document.write ("<p>toString: " + colour_names + "</p>"); colour_names = colours.join("-"); document.write ("<p>join: " + colour_names + "</p>"); colours.splice (3, 3, "Goldenrod", "Crimson"); document.write ("<p>splice: " + colours + "</p>"); </script>
Hergestellt in Deutschland / Made in Germany
COPYRIGHT © 2015-2024 IHY PRESS Frankfurt am Main 60329 Deutschland