<html>
<head>
<script>
function a()
{
var A=[3,6,5,9,2,1]
A.sort()
A.reverse()
var s=A.slice(0,3)
var f=s.join("#")
alert(f)
}
</script>
</head>

<body>
<input type="button" value="clickme"
onclick="a()"/>
</body>
</html>

<html>
<head>
<script>
function a()
{
var s="3!6!5!9!2!1"
var A=s.split("!")
A.sort()
A.reverse()
var s=A.slice(0,3)
var f=s.join("$")
alert(f)
alert(f.indexOf("$6")!=-1)
}
</script>
</head>

<body>
<input type="button" value="clickme"
onclick="a()"/>
</body>
</html>

posted on 2017-12-09 23:05  yep‘’  阅读(199)  评论(0)    收藏  举报