<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
// 数组的常用方法
// 1.数组的转换为字符串join()
var arr=[4,3,2,7];
var res=arr.join('-');
console.log(res)
//2.查找数组中的某几项slice(开始索引,结束索引)相当于切片的功能,如果只传入一个参数,那么就是分片到结尾的
var arr1=[5,6,7,8,9,1];
var res1=arr1.slice(2);
console.log(res1);
//3.splice(开始索引,删除个数,替换删除个数的内容)删除数组中指定几项的操作
//注意:这个splice()方法的返回值是被删除的元素!!
var arr2=[11,2,32,42,53,6];
var res2=arr2.splice(1,2,'hi')
console.log(arr2);
console.log(res2);
</script>
</body>
</html>