zsydgithub 2 лет назад
Родитель
Сommit
5ca4bc9a3d
4 измененных файлов с 122 добавлено и 0 удалено
  1. 42 0
      9_es6/11_ES6类.html
  2. 16 0
      9_es6/12_symbol.html
  3. 33 0
      9_es6/13_Set.html
  4. 31 0
      9_es6/14_map.html

+ 42 - 0
9_es6/11_ES6类.html

@@ -0,0 +1,42 @@
+<!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>
+    class Person{
+      constructor(name){
+        this.name = name
+      }
+      //方法
+      eat(){
+        console.log(this,'吃')
+      }
+      //类  方法  调用
+      static say(){
+        console.log(this,'xxxxxxxx')
+      }
+    }
+
+    class Coder extends Person{
+      constructor(name,age){
+        super(name)
+        this.age = age
+      }
+    }
+
+    var p1 = new Person('zs')
+    console.log(p1)
+    Person.say()
+
+
+    var a1 = new Coder('lisi',18)
+    console.log(a1)
+    a1.eat()
+  </script>
+</body>
+</html>

+ 16 - 0
9_es6/12_symbol.html

@@ -0,0 +1,16 @@
+<!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>
+    /* 基本数据类型  string  number boolean undefined null  symbol */
+    var a = Symbol()
+    console.log(a)
+  </script>
+</body>
+</html>

+ 33 - 0
9_es6/13_Set.html

@@ -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>
+</head>
+<body>
+  <script>
+    var arr = [1,2,3,1,2,3,4]
+
+    var x = new Set(arr)
+    var arr2 = Array.from(x)
+    console.log(arr2)
+
+
+    function quchong(arr){
+      return Array.from(new Set(arr))
+    }
+
+    console.log(quchong([1,2,23,4,56,7,7,123,14,4,5,5,6]))
+
+
+    var s1 = new Set([1,2,3,4])
+    console.log(s1)
+    s1.add(8)
+    console.log(s1)
+    s1.delete(1)
+    console.log(s1)
+  </script>
+</body>
+</html>

+ 31 - 0
9_es6/14_map.html

@@ -0,0 +1,31 @@
+<!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>
+    var obj = {
+      name:'zs'
+    }
+
+    var a1 = new Map()
+    a1.set('age',20)
+    // a1.set(obj,'aaa')
+    a1.set('name','lisi')
+    // console.log(a1)
+
+    // console.log(a1.get('name'))
+    // console.log(a1.get(obj))
+
+    /* entries()   key  value  都拿出来 放在数组里面 */
+    for(item of a1.entries()){
+      console.log(item)
+    }
+    console.log(a1)
+  </script>
+</body>
+</html>