首页 > 代码库 > 每天一个JavaScript实例-标量参数和数组参数的功能性区别

每天一个JavaScript实例-标量参数和数组参数的功能性区别

<!DOCTYPE>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>每天一个JavaScript实例-标量参数和数组参数的功能性区别</title>
<script>
	window.onload = function(){
		var items  = new Array('apple','orange','cherry','lime');
		var sep = "*";
		func(items,sep);
		console.log(items);
		console.log(sep);
		}
		function func(strings,separator){
			var result = "";
			//console.log(strings.length);
			for(var i = 0; i < strings.length; i++){
					result+=  strings[i] + separator;
				}
					separator = result;
					strings[strings.length] = result;
					
			}
</script>
</head>

<body>
</body>
</html>

每天一个JavaScript实例-标量参数和数组参数的功能性区别