递归出题
This commit is contained in:
33
teaching/jwl/课件/es6/jiegoufuzhi.html
Normal file
33
teaching/jwl/课件/es6/jiegoufuzhi.html
Normal file
@@ -0,0 +1,33 @@
|
||||
<!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>
|
||||
<script>
|
||||
// let a=1;
|
||||
// let b=2;
|
||||
// let c=3
|
||||
|
||||
// let [a,b,c]=[1,2,3]
|
||||
|
||||
// 数组的解构
|
||||
// 数组是有序的 所以按索引值匹配
|
||||
// 匹配不到的话 变量值为undefined
|
||||
let [a,[b],[c]]=[1,[2],[4]]
|
||||
|
||||
|
||||
// 对象解构
|
||||
// 对象是无序的 变量必须与属性同名,才能取到正确的值。
|
||||
// 匹配不到的话 变量值为undefined
|
||||
// 对象在解构赋值的时候 先找同名属性,再赋值给对应的变量 真正被赋值的是后面的变量
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
63
teaching/jwl/课件/es6/letconst.html
Normal file
63
teaching/jwl/课件/es6/letconst.html
Normal file
@@ -0,0 +1,63 @@
|
||||
<!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>
|
||||
<script>
|
||||
console.log(a)
|
||||
var a=9
|
||||
function a(){}
|
||||
|
||||
|
||||
// var num=2 //var 是js里面定义变量的关键字
|
||||
// console.log(num)
|
||||
// num=9
|
||||
// console.log(num)
|
||||
|
||||
// const num1=2 // 常量是定义以后值不能改变的量 声明的话 用const关键字
|
||||
// // 使用常量的时候,初始值不能为空 初始值为空的常量没有意义
|
||||
// console.log(num1)
|
||||
// num1=8
|
||||
// console.log(num1)
|
||||
|
||||
// var和let 都是用来声明变量的
|
||||
// var num=2
|
||||
// var num=8
|
||||
// console.log(num)
|
||||
|
||||
console.log(num,"llo")
|
||||
let num=2
|
||||
// let num=8
|
||||
console.log(num)
|
||||
// let 不能在同一个块级作用域中重复声明
|
||||
|
||||
for(var i=0;i<5;i++){
|
||||
let num=8
|
||||
console.log(num)
|
||||
}
|
||||
|
||||
function f(){
|
||||
let num=5
|
||||
let name="a"
|
||||
function g(){
|
||||
let name="b"
|
||||
console.log(name)
|
||||
function c(){
|
||||
// let name="c"
|
||||
console.log(name)
|
||||
}
|
||||
c()
|
||||
}
|
||||
console.log(num)
|
||||
console.log(name)
|
||||
g()
|
||||
}
|
||||
f()
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
53
teaching/jwl/课件/es6/setmap.html
Normal file
53
teaching/jwl/课件/es6/setmap.html
Normal file
@@ -0,0 +1,53 @@
|
||||
<!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>
|
||||
<script>
|
||||
|
||||
// console.log(arr[2])
|
||||
var arr1=[1,2,3,4,2,1]
|
||||
// console.log(arr1[2])
|
||||
|
||||
var arr=new Set([1,2,3,4,2,1])
|
||||
arr.add("pplo")
|
||||
var you=arr.has(2)
|
||||
// console.log(you)
|
||||
arr.delete(1)
|
||||
// console.log(arr) //[1,2,3,4]
|
||||
|
||||
function clearall(){
|
||||
arr.clear()
|
||||
console.log(arr,"drop")
|
||||
}
|
||||
|
||||
// set的遍历 因为set类型不能用 索引访问 而且他属于iterable类型 所有属于iterable类型的都能用for of遍历
|
||||
// set遍历是可以用for of的
|
||||
// for(let i of arr){
|
||||
// console.log(i)
|
||||
// }
|
||||
// set和数组的区别
|
||||
// 1. set数据结构会过滤掉重复的元素
|
||||
// 2. set不能按照数组的索引值直接获取 数组能按照索引值获取值
|
||||
// 3.数组的创建方式有很多种,但是set数据结构的创建方式只有一种 这个创建方式就是 new Set
|
||||
|
||||
// console.log(arr.size)
|
||||
let arrs=Array.from(arr)
|
||||
// console.log(arrs)
|
||||
// console.log(arrs[2])
|
||||
|
||||
|
||||
// map : 它类似于对象,也是键值对的集合,但是“键”的范围不限于字符串,各种类型的值(包括对象)都可以当作键。也就是说,Object 结构提供了“字符串—值”的对应,Map 结构提供了“值—值”的对应,
|
||||
var map1=new Map()
|
||||
var obj={name:"asd"}
|
||||
map1.set(obj,"这是值")
|
||||
console.log(map1)
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<button onclick="clearall()">清空</button>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user