Home >Web Front-end >JS Tutorial >JavaScript array object assignment usage examples_javascript skills
The examples in this article describe the usage of JavaScript array object assignment. Share it with everyone for your reference. The details are as follows:
The use of JavaScript array objects here will make your JS program concise and efficient, but it seems that many novices don’t like to use arrays because they think they are abstract and difficult to understand. In fact, as long as you understand it carefully, it It's like piercing the window paper, making you suddenly enlightened. I hope that through this example, you will have a better understanding of arrays.
The operation effect diagram is as follows:
The specific code is as follows:
<html> <head> <meta http-equiv="content-type" content="text/html; charset=GB2312" /> <title>Js数组对象方法应用示例</title> </head> <body style="overflow:auto;"> <div style="font-size:12px; font-weight:bold; color:white; font-family:Arial, 宋体; background-color:#6090DA; padding:4px 10px;"> <script type="text/javascript"> var user_inputs = new Array(); var str; while(str=prompt("请输入任意内容:",""))user_inputs.push(str); user_inputs.sort(); document.write("你输入的内容排序后的结果为:<br>"+user_inputs.join("<br>")); </script> </div> </body> </html>
I hope this article will be helpful to everyone’s JavaScript programming design.