其他分享
首页 > 其他分享> > js2

js2

作者:互联网

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			var arr = ['a','b','c'];
			var result = arr.join("+");
			alert(result);
			alert(arr.length);//var result = arr.join("+");这是一个拼接字符
			//直接在中间拼接的不改变原来的数组长度,只是对字符简单的拼接
			var acc = arr.reverse();
			alert(acc);//物理反转
		</script>
	</head>
	<body>
	</body>
</html>

  

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			var arr = "你好呀";
			alert(arr);
			var temp = encodeURI(arr);
			alert(temp);
			
			alert(decodeURI(temp));
		</script>
	</head>
	<body>
	</body>
</html>

  

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			var arr = [1,2,3,"a",true];
			var aaa = newArray();//默认长度是0
			/* for(int i = 0; i < 4 ;i++)
			{
				alert(arr[i]);
			} */
			alert(arr.length);
		</script>
	</head>
	<body>
	</body>
</html>

  

标签:arr,temp,alert,拼接,result,js2,var
来源: https://www.cnblogs.com/shuangshuangzi/p/15077039.html