Home > Web Front-end > JS Tutorial > JavaScript array object assignment usage examples_javascript skills

JavaScript array object assignment usage examples_javascript skills

WBOY
Release: 2016-05-16 15:47:05
Original
1782 people have browsed it

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>

Copy after login

I hope this article will be helpful to everyone’s JavaScript programming design.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template