代码改变世界

4.字符串排序

2017-04-13 15:40  笨笨03  阅读(156)  评论(0编辑  收藏  举报

 1 <!DOCTYPE html>
 2 <html>
 3 <head lang="en">
 4     <meta charset="UTF-8">
 5     <title>T72-js字符串排序</title>
 6 </head>
 7 <body>
 8 </body>
 9 
10 <script type="text/javascript">
11     var a = "if you can't enjoy the music at a sensible volume";
12     var b = a.split("");
13         b.sort();
14     var c = b.join("");
15 
16     document.write(c);
17 
18 
19 </script>
20 
21 </html>
View Code
效果图:

<!DOCTYPE html>

<html>
<head lang="en">
<meta charset="UTF-8">
<title>T72-js字符串排序</title>
</head>
<body>
</body>

<script type="text/javascript">
var a = "if you can't enjoy the music at a sensible volume";
var b = a.split("");
b.sort();
var c = b.join("");

document.write(c);


</script>

</html>