Correction status:Uncorrected
Teacher's comments:
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>JS基础{数组,增删改}</title>
</head>
<body>
<script>
//数组定义 1
var arr1 = new Array('a','b','c','d');
// console.log(arr1);
//数组定义 2
var arr2 = ['e','f','g'];
// console.log(arr2);
//push()给数组尾添加元素
var arr3 = ['a','b','c'];
arr3.push('d');
// console.log(arr3);
//pop()删除数组最后一个元素
var arr4= ['a','c','e','f'];
arr4.pop();
// console.log(arr4);
//unshift()给数组开头添加元素
var arr5=['z','x','c','v'];
arr5.unshift('q','a');
// console.log(arr5);
//shift()删除数组开头元素
var arr6=['a','s','d','f','g','h'];
arr6.shift();
arr6.shift();
// console.log(arr6);
//slice()在数组内选定元素 返回
var arr7=['q','w','e','r','t','s','a','t'];
var res1 = arr7.slice(0,3);
// console.log(res1);
//concat()多个数组进行连接
var res2 = arr1.concat(arr2.concat(arr3));
// console.log(res2);
//indexOf 返回指定数组的下标
var res3 = arr7.indexOf('t');
// console.log(res3);
//Array.isArray()判断对象是否为数组
var no = '666666666aaa6sd6a]d4sa';
var res4 = Array.isArray(no);
// console.log(res4);
//join():把数组转化为字符串
var arr8 = ['a','c','d','b'];
var res5 = arr8.join('---');
// console.log(res5);
//includes()判断数组是否包含指定值
var res6 = arr8.includes('q');
console.log(res6);
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>JS DOM事件</title>
</head>
<body>
<button onclick="d()">单击我</button>
<button ondblclick="s()">双击我</button>
<button onmouseover="y()">移到我</button>
<button onmouseout="l()">离开我</button>
<input type="text" onblur="j()" placeholder="请输入!">
<script>
//onclick()当用户单击该元素调用的事件
function d() {
alert('被单击我就出来了');
}
//ondblclick()当用户双击该元素调用的事件
function s() {
alert('被双击我就出来了');
}
//onmouseover()鼠标移到该元素
function y() {
console.log('碰到我了!')
}
//onmouseout()鼠标离开某元素
function l() {
console.log('离开我了!!!')
}
//onblur()失去该元素焦点
function j() {
alert('离开输入框')
}
</script>
</body>
</html>